Skip to content

Latest commit

 

History

History
139 lines (114 loc) · 5.79 KB

webhooks.md

File metadata and controls

139 lines (114 loc) · 5.79 KB

Webhooks

Each space can notify another system when testimonials arrive or get approved: post to a Slack channel through Zapier or n8n, add a row to a spreadsheet, or trigger your own code.

To set one up, open the space, enter a Webhook URL under notifications and save. Send a test event delivers a sample right away and shows what your endpoint answered.

When Kindwall calls you

Kindwall-Event Sent when
testimonial.created someone sends a testimonial through the space's collection page
testimonial.approved a testimonial becomes approved: by hand, in bulk, or by the space's auto-approve rule
test you press Send a test event

A submission that the auto-approve rule accepts produces both events: testimonial.created, then testimonial.approved. Imported testimonials don't produce any.

What you receive

A POST with a JSON body and these headers:

Header Value
Content-Type application/json
Kindwall-Event the event name
Kindwall-Signature t=<unix seconds>,v1=<signature> (see below)
{
  "event": "testimonial.approved",
  "createdAt": "2026-12-02T10:15:00.000Z",
  "space": { "id": "3b0c…", "name": "Lumen Notes", "slug": "lumen-notes" },
  "testimonial": {
    "id": "8e21…",
    "spaceId": "3b0c…",
    "spaceName": "Lumen Notes",
    "status": "approved",
    "origin": "form",
    "source": null,
    "sourceUrl": null,
    "body": "Our support team answers twice as fast since we moved our notes to Lumen.",
    "bodyEdited": false,
    "rating": 5,
    "authorName": "Ada Park",
    "authorTitle": "Head of Support",
    "authorCompany": "Fernhill",
    "authorEmail": "ada@fernhill.example",
    "authorUrl": null,
    "avatarUrl": null,
    "video": null,
    "featured": false,
    "tags": [],
    "consentText": "I agree that Lumen may publish this testimonial…",
    "consentedAt": "2026-12-02T10:12:41.000Z",
    "date": "2026-12-02T10:12:41.000Z",
    "approvedAt": "2026-12-02T10:15:00.000Z",
    "createdAt": "2026-12-02T10:12:41.000Z"
  },
  "dashboardUrl": "https://kindwall.example.com/inbox"
}

testimonial has the same shape as in the HTTP API, with absolute photo and video addresses. For the test event it is null.

The body includes the author's email address, which never appears on a wall. Store and forward it with the same care you'd give any customer's details. Photo and video addresses of testimonials that aren't approved only open for signed-in members of the workspace.

Checking the signature

Anyone who learns your webhook URL could post to it, so check that each request really came from your Kindwall server. Every space has its own signing secret (it starts with whsec_); copy it from the space's settings.

Kindwall-Signature holds a timestamp t and a signature v1. To check it:

  1. Take the request body exactly as received, before parsing it.
  2. Compute HMAC-SHA256 of <t>.<body> with the secret, and encode it as base64url (no padding).
  3. Compare it with v1 in constant time.
  4. Reject the request if t is more than five minutes from now, so a recorded request can't be replayed later.

Node.js:

import { createHmac, timingSafeEqual } from "node:crypto";

export function isFromKindwall(rawBody, signatureHeader, secret, now = Date.now()) {
  const fields = new Map(signatureHeader.split(",").map((pair) => pair.split("=", 2)));
  const timestamp = Number(fields.get("t"));
  const received = fields.get("v1");
  if (!received || !Number.isInteger(timestamp)) return false;
  if (Math.abs(now / 1000 - timestamp) > 300) return false;

  const expected = createHmac("sha256", secret)
    .update(`${timestamp}.${rawBody}`)
    .digest("base64url");
  const a = Buffer.from(expected);
  const b = Buffer.from(received);
  return a.length === b.length && timingSafeEqual(a, b);
}

Python:

import base64, hashlib, hmac, time

def is_from_kindwall(raw_body: bytes, signature_header: str, secret: str) -> bool:
    fields = dict(part.split("=", 1) for part in signature_header.split(","))
    try:
        timestamp = int(fields["t"])
        received = fields["v1"]
    except (KeyError, ValueError):
        return False
    if abs(time.time() - timestamp) > 300:
        return False
    digest = hmac.new(secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256).digest()
    expected = base64.urlsafe_b64encode(digest).rstrip(b"=").decode()
    return hmac.compare_digest(expected, received)

If a secret leaks, choose New secret in the space's settings. The old one stops working at once, so update your receiver at the same time.

Delivery rules

  • Kindwall waits up to 5 seconds for an answer. Any 2xx status counts as delivered.
  • Redirects are not followed; point the URL at the final address.
  • Version 0.1 doesn't retry. Failed deliveries are written to the server log, and the test button shows the status or error your endpoint produced.
  • URLs must use http or https and can't contain a username or password. If your receiver needs a token, put it in the path or query string, or rely on the signature.
  • By default a webhook can only reach addresses on the public internet, so nobody can use your server to probe its own network. On a server where everyone who can make a workspace is trusted, WEBHOOKS_ALLOW_PRIVATE=true lifts that, for example to reach n8n on your LAN.