A business registers its own webhook endpoints through this API. This is separate from Resend's inbound email webhook, which is BeniBrain's own infrastructure and isn't part of this integration surface — the endpoints below are for a business's outbound notifications about its own orders and bookings.
A business adds webhook endpoints in Settings → Developers → Webhooks (or through these endpoints with a dashboard session). Each business can register up to 10 endpoints.
Event catalogue
| Event | Fires when |
|---|---|
conversation.created | A new customer conversation starts |
message.received | A customer sends a message |
order.created | A store order is created |
order.paid | An order's payment is confirmed |
order.fulfilled | An order is marked fulfilled/shipped |
order.refunded | An order is refunded (partial or full) |
order.cancelled | An order is cancelled |
invoice.paid | An invoice is paid |
invoice.sent | An invoice is sent to a customer |
invoice.voided | An invoice is voided |
booking.created | A booking is created |
booking.confirmed | A booking's payment/hold is confirmed |
booking.cancelled | A booking is cancelled |
booking.rescheduled | A booking's time is changed |
Subscribe to specific events with a comma-separated events list, or "*" for everything.
Registering an endpoint
{
"url": "https://yoursite.com/webhooks/benibrain",
"events": "order.paid,order.refunded,booking.confirmed"
}The endpoint must be a publicly reachable https:// URL — it's validated both at registration and again at every delivery (covering DNS rebinding and endpoints that later start resolving to a private address). The response includes a secret field, shown only once at creation — store it to verify signatures.PATCH /webhooks/{id} updates the URL/events/active state, POST /webhooks/{id}/test sends a test payload, and GET /webhooks/{id}/deliveries returns recent delivery attempts with status codes and errors, newest first (25 at a time by default, up to 50 with limit).
Payload & signing
{
"eventId": "8e2f...",
"eventType": "order.paid",
"occurredAt": "2026-09-18T14:02:11.000Z",
"businessId": "biz_1",
"schemaVersion": "2026-09-02",
"event": "order.paid",
"timestamp": "2026-09-18T14:02:11.000Z",
"data": { "orderId": "ord_456", "totalAmount": 29.0, "currency": "gbp" }
}Every delivery carries these headers:
| Header | Purpose |
|---|---|
X-BeniBrain-Event | The event type |
X-BeniBrain-Event-Id | Stable ID for this delivery — use it for idempotency |
X-BeniBrain-Signature | sha256=… — HMAC-SHA256 of the raw body using your webhook secret |
Idempotency-Key | Same value as X-BeniBrain-Event-Id |
import crypto from "node:crypto";
function isValid(rawBody, signatureHeader, secret) {
const expected = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signatureHeader));
}Verify against the raw request body (before JSON parsing) and use eventId to de-duplicate — retries reuse the same ID rather than minting a new one.
Retries & reliability
A delivery is attempted once, then retried up to 3 times with exponential backoff (1s, 2s, 4s) if your endpoint doesn't return a 2xx within 10 seconds. Endpoints that repeatedly fail — or that stop resolving to a public, non-private address — are automatically disabled; check GET /webhooks/{id}/deliveries if events stop arriving.