> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superskope.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a webhook receiver

> Verify raw bytes, durably deduplicate and acknowledge before running your worker.

A webhook is a notification to your server. It is not authorization for an AI model to send a reply. Keep end-user identity, business policy and approvals in your own application.

## Request example

This invented payload illustrates a received-message notification. It contains identifiers and metadata, not the message text or a public media URL.

```json theme={null}
{
  "id": "67b94768-c24b-4fb4-a281-97d54862927c",
  "type": "message.received",
  "createdAt": "2026-11-26T09:00:00.000Z",
  "accountId": "910000000001@c.us",
  "chatId": "120000000000@g.us",
  "data": {
    "messageId": "false_120000000000@g.us_EXAMPLE",
    "fromMe": false,
    "ack": 1,
    "timestamp": 1795683600
  }
}
```

The same envelope supports message sent/receipt/reaction/edited/deleted, group joined/left/updated/participants, submission/uncertainty, connection changes and scoped `agent.message` activations. An activation carries `agentId` and `eventId`; fetch private content through the [agent API](https://docs.superskope.com/developers/agents.md). `chatId` can be null for phone-level events. Fields vary by event type. Available events depend on the installed engine subscriptions; reading this page does not change a linked session.

## Verify before parsing

```js theme={null}
import { verifySuperSkopeWebhook } from '@superskope/sdk/webhooks';

// rawBody is the untouched Buffer received from HTTP, before JSON middleware.
const event = verifySuperSkopeWebhook(rawBody, request.headers, secret);
if (!event) {
  response.writeHead(401).end();
  return;
}
// Insert event.id and its payload into a private durable queue, atomically.
// A duplicate returns success without creating another queued job.
await inbox.insertOnce(event);
response.writeHead(202).end();
```

The secret is the webhook signing secret, not the customer API key. Header timestamp is Unix seconds. Verification covers the exact bytes of `timestamp + '.' + rawBody`. The bundled verifier checks a five-minute window, compares HMAC-SHA256 signatures in constant time and bounds the body at 16 KiB.

The repository example `examples/node/webhook-receiver.mjs` implements private SQLite intake, duplicate-content checks and bounded queue capacity. It starts no outgoing worker. Install it behind your own HTTPS endpoint before configuring the webhook.

## Delivery and recovery

1. Commit the event to durable storage before responding with 2xx.
2. Run long work asynchronously; the sender has an eight-second deadline.
3. Expect duplicate and out-of-order delivery. Use the event ID for intake deduplication and a separate persisted business-intent key for each intended effect.
4. Do not order work by delivery time. Re-read current authorized state before changing anything.
5. Failed callbacks retry eight times in total. Exhausted delivery does not automatically redrive.
6. If a send becomes unknown, inspect the original API operation. Replaying the webhook is never permission to resend the WhatsApp message.

Changing the webhook URL rotates its secret and cancels queued old deliveries. An already submitted attempt may finish. Keep this in your receiver rotation procedure. See the [full delivery contract](https://docs.superskope.com/developers/events.md).

## n8n and Zapier

Use this verifier/queue before forwarding to an authenticated internal workflow trigger. A public Catch Hook by itself does not verify SuperSkope signatures. Store the event ID and original request key with the workflow execution so a workflow retry cannot create a new send. No native n8n/Zapier application is currently shipped.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.