Skip to content
Chatwise
Skip to Content
Developer docs
Events

comment.received

Coming soon, not sent yet. Someone commented on a post of a connected Instagram account.

View as Markdown

Coming soon

Endpoints can subscribe to this event, but nothing is sent for it yet. Its payload may change before it is.

Channels: Instagram.

Headers

HeaderDescriptionExample
webhook-idThe event's id, the same on every retry and redelivery. Dedupe on it.evt_01JE2Z3QK4T8M6N2R5S7V9W1X3
webhook-timestampWhen this attempt was signed, in Unix seconds.1794475538
webhook-signatureOne or more signatures, separated by spaces: v1, and the base64 HMAC-SHA256 of <webhook-id>.<webhook-timestamp>.<body>.v1,<base64>
X-Chatwise-EventThe event's name.comment.received
X-Chatwise-DeliveryThe delivery's id.wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90
User-AgentAlways Chatwise-Webhooks/1.0.Chatwise-Webhooks/1.0

Payload

The contents of data aren't decided yet. The outer fields are the same as every event's.

{
  "id": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3",
  "type": "comment.received",
  "timestamp": "2026-11-12T09:25:36.000Z",
  "apiVersion": "2026-12-01",
  "workspaceId": "42",
  "data": {}
}
FieldTypeDescription
idstringThe event's id, the same on every retry and redelivery. Also the webhook-id header.
typestringThe event's name. Also the X-Chatwise-Event header. Always comment.received.
timestampstringWhen the event happened. The same on every retry. ISO 8601, in UTC.
apiVersionstringThe payload format, as a date.
workspaceIdstringThe workspace the event happened in.
dataobjectWhat happened.

Fields are only ever added within an apiVersion, so ignore the ones you don't know.

Verify it

Check the signature against the raw body before you trust the event. Verify signatures explains each step and has a complete server.

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

const FIVE_MINUTES = 5 * 60;

// rawBody is the request body exactly as received (a Buffer or a string).
// headers has lowercase names, as Node's request.headers does.
export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) {
  const id = headers["webhook-id"];
  const timestamp = headers["webhook-timestamp"];
  const signatures = headers["webhook-signature"];
  if (!id || !timestamp || !signatures) return false;

  // Refuse old requests, so a captured one can't be sent again later.
  if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false;

  const key = Buffer.from(secret.slice("whsec_".length), "base64");
  const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest();

  // While a secret is being rotated there are two signatures. One match is enough.
  return signatures.split(" ").some((signature) => {
    const [version, value = ""] = signature.split(",");
    const received = Buffer.from(value, "base64");
    return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected);
  });
}

Answer it

Answer with any 2xx status within 10 seconds, and do the work afterwards. The same event can arrive more than once, so skip a webhook-id you already handled. What other answers do is in delivery and retries.

On this page