call.started
Sent to your webhook endpoints (of the call's env) when the engine has accepted a call and the browser can connect.
webhook-id*stringThe event's id. The same on every retry and replay of it, so dedupe on it.
^evt_[0-9A-Za-z]{20}$"evt_3Kp8Zr1WqN6xBv4MhS9a"webhook-timestamp*stringUnix seconds when this attempt was sent, as a decimal string. It is signed in, so refuse one more than 5 minutes away from now.
^[0-9]+$webhook-signature*stringOne v1,<base64> per secret still signing, space-separated (two after a rotation, during its grace).
To verify: the signature is the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{raw body}, keyed
with the bytes of the secret (the base64 after whsec_, decoded). Check the raw body before parsing it,
refuse a timestamp more than 5 minutes off, compare in constant time, and accept if any v1, signature
matches. Any Standard Webhooks library does all of this (npm i standardwebhooks, pip install standardwebhooks, Go, Rust, PHP, Ruby: new Webhook(secret).verify(rawBody, headers)). By hand, in Node:
import crypto from "node:crypto";export function verifyWebhook(secret, headers, rawBody) { const id = headers["webhook-id"], ts = headers["webhook-timestamp"], sigs = headers["webhook-signature"] ?? ""; if (!id || !ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = crypto.createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest(); return sigs.split(" ").some((s) => { if (!s.startsWith("v1,")) return false; const given = Buffer.from(s.slice(3), "base64"); return given.length === expected.length && crypto.timingSafeEqual(given, expected); });}^v1,[A-Za-z0-9+/]+={0,2}( v1,[A-Za-z0-9+/]+={0,2})*$"v1,j3DA+jkjXWui/cEnonEAVLuZfyTYaPasc6ZdLT4x/Vk="user-agent*stringAlways daxov-webhooks/1.
application/json- body
Every webhook delivery's body. The JSON is compact, with its keys in alphabetical order.
{ "created_unix": 1793300001, "data": { "billed_seconds": 0, "character_id": "chr_4fT9kQ2mXw7LbN3pZs8V", "character_name": "Alex", "charged_usd": 0, "created_unix": 1793300000, "env": "live", "id": "call_2Gx7Mb9KpQ4sVn1ZrT6e", "max_seconds": 300, "metadata": { "ticket": 7 }, "mode": "video", "price_per_min_usd": 0.6, "settled_unix": null, "source": "api", "status": "waiting" }, "id": "evt_3Kp8Zr1WqN6xBv4MhS9a", "type": "call.started"}id*EventId^evt_[0-9A-Za-z]{20}$"evt_3Kp8Zr1WqN6xBv4MhS9a"type*stringThe event's type.
created_unix*UnixUnix seconds, UTC.
int641793300000data*A call as webhooks carry it: the Call shape without error and end_reason (call.ended has reason instead).
Delivered. Answer any 2xx within 10 seconds, then do the slow work. The body is ignored.
{ "created_unix": 1793300001, "data": { "billed_seconds": 0, "character_id": "chr_4fT9kQ2mXw7LbN3pZs8V", "character_name": "Alex", "charged_usd": 0, "created_unix": 1793300000, "env": "live", "id": "call_2Gx7Mb9KpQ4sVn1ZrT6e", "max_seconds": 300, "metadata": { "ticket": 7 }, "mode": "video", "price_per_min_usd": 0.6, "settled_unix": null, "source": "api", "status": "waiting" }, "id": "evt_3Kp8Zr1WqN6xBv4MhS9a", "type": "call.started"}{ "webhook-id": "evt_7Rc2Yj5LmT9pQw3NdF6k", "webhook-timestamp": "1793300100", "webhook-signature": "v1,j3DA+jkjXWui/cEnonEAVLuZfyTYaPasc6ZdLT4x/Vk=", "user-agent": "daxov-webhooks/1"}