Webhook Reference

Sela sends outbound webhooks server-to-server with HMAC signatures, timestamp headers, and automatic retries.

Headers

text
X-Sela-Event: conversation.created
X-Sela-Delivery: whd_...
X-Sela-Timestamp: 1712345678901
X-Sela-Signature-Version: v1
X-Sela-Signature: <hex hmac sha256>

Signing Format

Compute an HMAC-SHA256 using your stored secret over: timestamp + '.' + rawBody

javascript
import crypto from "node:crypto";

const signedPayload = `${req.headers["x-sela-timestamp"]}.${rawBody}`;
const expected = crypto
  .createHmac("sha256", process.env.SELA_WEBHOOK_SECRET!)
  .update(signedPayload)
  .digest("hex");

Order Events

Subscribe to order.* to receive every restaurant order event. Payloads include the order ID, status, customer, fulfillment details, summary, and optional external order ID.

text
order.created
order.approved
order.rejected
order.arrived
json
{
  "event": "order.created",
  "timestamp": 1712345678901,
  "data": {
    "id": "toolExecutions:...",
    "status": "pending",
    "conversationId": "conversations:...",
    "customer": {
      "name": "Ali",
      "phone": "+964..."
    },
    "fulfillment": {
      "type": "delivery",
      "address": "Al Mansour"
    },
    "orderSummary": "2 burgers, fries, delivery fee included",
    "specialInstructions": null,
    "externalOrderId": null
  }
}

Retries

If your endpoint returns a non-2xx response or times out, Sela retries up to 5 times with exponential backoff. Treat X-Sela-Delivery as your deduplication key.