Webhooks
Receive a signed POST after every call ends — transcripts, recording link, function timeline, contact, and more.
When a call ends, dBel can POST a JSON payload describing the call to a URL you control. Use it to sync transcripts into your CRM, fire alerts on failed calls, kick off downstream automation, or just log every interaction.
This page covers: setup, the payload, signature verification (Python, Node, Go), retries, the recording URL, and rate limits.
1. Setup (one-time)
There are two pieces — a per-assistant URL that says where to send the event, and a workspace-level secret used to sign every request.
- Open Developer in the sidebar. In the Webhook Secrets card, click Generate Secret. Only workspace owners and admins can do this. The secret is shown once — copy it into your secrets manager. We store it encrypted, plus a masked preview (the first 8 and last 4 characters) so you can recognise it. If you lose it, generate a new one.
- Open the assistant you want to receive events for, scroll to Post-call Webhook URL, paste the HTTPS URL of your endpoint. (Plain
http://is rejected, except for dev-tunnel hosts such as ngrok, cloudflared and lhr.life.) - That's it. The next call to that assistant fires the webhook.
Secrets are stored per admin. When you generate a secret, dBel revokes only your own previous secret. A secret that another admin generated stays active. dBel signs every webhook with the newest active secret in the workspace, so after any admin generates one, verify with that one. With two active secrets, the Webhook Secrets card can show either one's masked preview. If an admin deletes their dBel account, their secret is revoked; webhooks are then signed with the newest remaining secret, or stop if none remains. Removing an admin from the workspace, or changing their role, does not revoke their secret — it can stay the one that signs. Plan rotations during a low-traffic window.
2. Payload
{
"event": "call.ended",
"deliveryId": "0c7b…",
"callId": "RM_xxx",
"assistantId": "asst_xxx",
"workspaceId": "ws_xxx",
"startTime": "2026-05-06T07:14:00.123000Z",
"endTime": "2026-05-06T07:18:32.456000Z",
"duration": 272,
"callType": "SIP",
"direction": "INBOUND",
"endReason": "CALLER_HANGUP",
"phoneNumber": "+18155762484",
"contact": {
"id": "ct_xxx",
"name": "Alice Example",
"phoneNumber": "+61400000000",
"email": "alice@example.com",
"browserVisitorId": null
},
"transcript": [
{
"speaker": "ASSISTANT",
"content": "Hi, how can I help?",
"timestamp": "..."
},
{
"speaker": "CONTACT",
"content": "I'd like to book Tuesday at 3pm.",
"timestamp": "..."
}
],
"recordingUrl": "https://dbel.ai/api/calls/RM_xxx/recording",
"summary": null,
"functionExecutions": [
{
"type": "transfer",
"name": "transfer_to_support",
"to": "+15555550123",
"destinationType": "phone",
"result": "failed",
"sipStatusCode": "403",
"sipStatus": "Forbidden",
"calledAt": "..."
},
{
"type": "lookup_kb",
"name": "lookup_kb",
"functionId": null,
"query": "what are your opening hours",
"hitCount": 3,
"calledAt": "..."
},
{
"type": "evaluate",
"outcome": "success",
"calledAt": "..."
}
]
}Field notes:
| Field | Notes |
|---|---|
event | Always "call.ended". Check it, and ignore any value your handler does not expect. |
deliveryId | UUID. Same value across all 3 retry attempts — use it to dedupe. |
startTime, endTime, transcript[].timestamp, functionExecutions[].calledAt | UTC, in ISO 8601 ending in Z — e.g. 2026-05-06T07:14:00.123000Z (the fraction is left out when it is zero). JavaScript's new Date() reads it as UTC. Python's datetime.fromisoformat() accepts a trailing Z from Python 3.11; before 3.11, replace the Z with +00:00 first. calledAt used to end in +00:00 and the other three in no offset at all; a parser that appends Z only when a value has no Z or offset keeps working. |
endReason | Connected calls: CALLER_HANGUP | ASSISTANT_DISCONNECT | TIME_LIMIT | IDLE_TIMEOUT | ERROR. ERROR can also end an outbound call before the callee answers, when something fails on dBel's side. TIME_LIMIT can also end an outbound call before it is dialed, when the workspace owner has less than one minute of plan minutes left (see Plan limits). Outbound dial outcomes (the call never reached a person): REJECTED (declined / busy), NO_ANSWER (rang out / unavailable), DIAL_FAILED (trunk/protocol error), VOICEMAIL (an answering machine picked up), OUTSIDE_CALLING_HOURS (refused before the dial: outside the callee's calling hours). See section 2.1. |
callType | "SIP" for phone calls (inbound and outbound — use direction to tell them apart), "PLAYGROUND" for browser test sessions, "WEB" for the web widget. Most customers ignore PLAYGROUND. |
direction | "INBOUND" (a call to your number) or "OUTBOUND" (a call your assistant placed). Always present. |
dialedNumber | Outbound only. The E.164 number your assistant dialed. The key is absent on inbound, web and playground calls (not null). |
clientReferenceId | Outbound only. The opaque id you passed when creating the call (e.g. a CRM record id), echoed back so you can correlate the result to your record. null on an outbound call where you didn't supply one. The key is absent on inbound, web and playground calls. |
optedOut | Outbound only. true when the person asked not to be called again during the call (see Outbound calling); add the number to your own do-not-call list. false otherwise. The key is absent on inbound, web and playground calls. |
phoneNumber | The phone number attached to the assistant when the webhook fires. For a call through that number, it is the number that received an inbound call, or the caller ID an outbound call dialed from. It is also filled on playground and web calls when the assistant has a number. It is null when the assistant has no number — for example, an assistant reached only through your own carrier (Connect via SIP Trunk). It is never the number dialed on your own trunk. Different from contact.phoneNumber / dialedNumber (the other party). |
contact | null for playground calls, unmatched SIP calls, web visits that captured no identifying detail, and outbound calls that were never answered. The object also carries browserVisitorId (set for web-widget contacts, otherwise null). contact.phoneNumber is null for web contacts. Enrichment (company, role, social, Google Places) is not in the payload, and it does not run automatically after a call. It runs only when someone clicks Enrich on the contact, or when you call POST /api/contacts/{id}/enrich (each counts against the workspace owner's plan limit; a contact with no phone number is refused). Read the result with GET /api/contacts/{id}. |
web | Web calls only (callType: "WEB"). { browserVisitorId, origin, metadata } — the visitor's browser id, the page origin, and the identity fields your embed passed (email, phone, name, fullName, company, companyName, customerId; other keys are dropped), or null. The key is absent on SIP and playground calls. |
transcript | Chronological utterances. speaker is ASSISTANT, CONTACT, or ASSISTANT_SMS (a text message the assistant sent during the call). With the assistant's Transcript setting off, only ASSISTANT_SMS rows appear (or none) — plus, when the caller agreed to a text, the texting question and their yes. In explicit-consent mode, a refusal stops the transcript. The transcript keeps the consent exchange and the assistant's reply to the refusal — plus the greeting with Continue without recording, or the goodbye with End the call — and no spoken lines after that, except the texting question and the caller's yes when they agree to a text. On an outbound call the transcript starts with the assistant's introduction, and nothing the callee says before the consent question is saved. After a refusal, no ASSISTANT_SMS rows are added; the sms entry in functionExecutions still records the send, without the text. |
recordingUrl | Permanent URL on our domain. null when no recording exists: recording is off for the assistant, the caller declined consent, the call ended before recording started, or the recording did not finish cleanly. See section 4 for fetching the audio. |
summary | Always null. The field is reserved; dBel does not generate a call summary. |
functionExecutions[] | Chronological audit log of every tool the LLM fired during the call (transfer, sms, info, book, custom, evaluate, lookup_kb, text_consent; on an outbound call also opt_out, with via and no caller words, alongside optedOut: true). The evaluate entry — if any — has outcome: "success" | "failed" | "unknown"; that's where the call disposition lives. Customer parsers do executions.find(e => e.type === "evaluate"). Transfer entries carry a result and, on failure, a SIP status — see below. functionId may be null: platform/built-in tools (e.g. lookup_kb knowledge-base search) have no user-created Function record. Key off type, not functionId — do not assume every entry maps to a Function you created. If the assistant has an evaluate function and the call ends before the model calls it, dBel adds an evaluate entry with outcome: "unknown", autoRecorded: true and reason: "call_ended_without_llm_evaluation". This covers inbound, web and playground calls, and outbound calls that were answered — by a person or by a voicemail system. An outbound call that was never answered (NO_ANSWER, REJECTED, DIAL_FAILED, OUTSIDE_CALLING_HOURS, or a TIME_LIMIT / ERROR before the callee answered) gets no entry. On a voicemail call the entry means only that no conversation was scored; it says nothing about call quality. Entries the model wrote have no autoRecorded key. An sms entry for a send carries the text as body. After a recording refusal it keeps the same send record without body: the envelope (functionId, type, name, calledAt), to, from, twilioStatus, and messageSid on a successful send or twilioError on a failed one. The body is the text as sent: your business name first, and on the first text in a call the opt-out line (see Texting callers). An sms entry that sent nothing carries skipped with the reason, for example no_consent (the caller didn't say yes), cap_reached (two texts per call), sms_opted_out (the person replied STOP to an earlier text), au_registration_missing (Twilio needs an approved business profile on the sending account to text Australian numbers: Twilio error 60250), sender_not_allowed (this number can't text that country), stop_handling_unconfirmed, us_dbel_number, us_not_registered, us_no_policy_links, us_texting_off, tollfree_not_verified, ca_no_sender_details (no business address or no callback number), no_business_name, too_long, ask_failed (the question could not be put), empty_body (the text rendered blank), destination_not_allowed, or error (with error, the error's type). A book entry's smsSkipped takes the same reasons, or awaiting_consent while the text waits for the caller's answer; the answer then adds a book entry with result: "confirmation_text", smsSent, and smsSkipped when nothing was sent. A text_consent entry (functionId: null) records each answer to the assistant's texting question: result ("yes", "no", "unclear" or "timeout"), ask ("us_script", the full script read to a US mobile, or "short_ask", the short question for a Canadian or Australian mobile), version (which wording was read), askedAt and answeredAt. It holds none of the caller's words; after a yes, the question and the answer are also kept in transcript, even after a recording refusal. |
2.1 Outbound calls
The same webhook fires for calls your assistant places (see Outbound calling). For those, direction is "OUTBOUND", dialedNumber is the number you dialed, and clientReferenceId echoes back the id you supplied — so you can match the result to the record that triggered the call (a CRM contact, a sheet row, a ticket). optedOut tells you the person asked not to be called again.
When an outbound call never connects to a live person, endReason carries the dial outcome instead of a hangup reason (or ERROR, if something fails on dBel's side before the callee answers):
endReason | Meaning |
|---|---|
REJECTED | The callee actively declined, or the line was busy. |
NO_ANSWER | Rang out / the callee was unavailable. |
DIAL_FAILED | The call couldn't be placed: a trunk, protocol or number error (any SIP failure other than busy, declined, timeout or unavailable). A transient server error (5xx) can succeed on retry; a number that does not exist fails again. A 403 whose reason names the caller ID (for example "Caller ID is unauthorized") also marks the caller-ID phone as failed verification, so your next outbound request returns PHONE_NOT_VERIFIED until that phone is verified again. Any other 403, such as a country block on the Twilio account, leaves the phone as it is. |
VOICEMAIL | An answering machine picked up. If voicemail drop is enabled and the mailbox accepted messages, dBel left your message. If voicemail drop is off, or the mailbox was full or unavailable, the call ended without a message. |
OUTSIDE_CALLING_HOURS | dBel did not dial: its calling-hours check refused the call, or dBel could not tell the callee's local time (a toll-free number). Nothing rang and no minutes were used. See Calling hours. |
An outbound call can also end with TIME_LIMIT before it is dialed. dBel checks the workspace owner's plan minutes again just before it dials, and it does not dial when less than one minute is left. See Plan limits.
A connected outbound call that reaches a person ends with the normal connected-call reasons (CALLER_HANGUP, etc.), same as inbound.
Reading transfer outcomes
Each transfer entry records to, destinationType ("phone" or "sip"), and result:
"transferred"— the transfer (SIP REFER) completed: the destination answered, and the caller is connected to it. A voicemail box, a phone menu or a conference that answers counts too. dBel has no view of the call after that. A transfer that nobody answers, or that the caller hangs up on while it rings, is"failed"."skipped:outside_hours"(and otherskipped:*) — a guard (e.g. the transfer's availability window) blocked it before any REFER was sent."failed"— the transfer didn't complete. The entry always carries anerrorstring (up to 200 characters). When the carrier or destination returned a SIP status, it also carriessipStatusCode+sipStatus. Branch on these to alert or fall back.
The code reflects which side failed — your carrier/trunk vs the destination — and the fix is on that side, not in dBel (we issue the same REFER regardless of carrier):
sipStatusCode | Side | Meaning |
|---|---|---|
403 | Your trunk | Carrier refused the transfer — call transfer / PSTN transfer not enabled, or dialing not permitted for that destination/region. |
404 | Destination | Destination address/number doesn't exist. |
407 | Destination | Destination wants SIP credentials — a cold transfer can't supply them; use IP-based trust. |
408 | Destination | Destination didn't answer in time. |
415 / 488 | Destination | Media/codec mismatch — destination must accept standard codecs (G.711) and matching encryption (SRTP on/off). |
480 | Destination | Destination unavailable or not registered (SIP-domain registrations resolve only within the same Twilio account and region: see Twilio's Regional SIP Domains). |
486 | Destination | Destination busy. |
5xx | Carrier/dest | Server error — usually transient; retry. |
For a call that came in over your own carrier (Connect via SIP Trunk), the transfer leaves over that carrier, so its call logs hold the definitive reason. See Transfer functions and Connect via SIP Trunk.
3. Verifying the signature
Every request includes:
| Header | Value |
|---|---|
X-dBel-Signature | sha256=<64-char lowercase hex> |
X-dBel-Timestamp | Unix seconds — used for replay protection |
X-dBel-Event | call.ended |
X-dBel-Delivery | UUID for this delivery (stable across retries) |
User-Agent | dBel-Webhook/1.0 |
Content-Type | application/json |
The signature is computed over f"{timestamp}.".encode() + raw_body. The timestamp prefix prevents capture-and-replay attacks: an attacker who records yesterday's signed request can't replay it tomorrow because the verification window is 5 minutes.
Always verify with the raw request body — not a JSON-parsed-and-restringified copy. JSON serialization is non-deterministic (key order, spacing) so the second pass produces different bytes, and the signature won't match.
Python (Flask)
import hmac, hashlib, json, os, time
from flask import Flask, request
app = Flask(__name__)
WEBHOOK_TOLERANCE_SECONDS = 300
def verify_signature(raw_body: bytes, signature_header: str,
timestamp_header: str, secret: str) -> bool:
try:
ts = int(timestamp_header)
except (TypeError, ValueError):
return False
if abs(int(time.time()) - ts) > WEBHOOK_TOLERANCE_SECONDS:
return False
if not signature_header.startswith("sha256="):
return False
received = signature_header[len("sha256="):]
expected = hmac.new(
secret.encode(),
f"{ts}.".encode() + raw_body,
hashlib.sha256,
).hexdigest()
return hmac.compare_digest(expected, received)
@app.post("/webhooks/dbel")
def dbel_webhook():
raw = request.get_data(cache=False) # NEVER request.get_json() then re-stringify
if not verify_signature(
raw,
request.headers.get("X-dBel-Signature", ""),
request.headers.get("X-dBel-Timestamp", ""),
os.environ["DBEL_WEBHOOK_SECRET"],
):
return ("", 401)
payload = json.loads(raw)
# … process payload …
return ("", 200)For other Python frameworks the only thing that changes is how you get the raw body:
- FastAPI:
raw = await request.body() - Django:
raw = request.body
Node (Express)
import express from "express";
import crypto from "crypto";
const app = express();
const TOLERANCE = 300;
// CRITICAL: use express.raw() so we get bytes, not a parsed object.
app.post(
"/webhooks/dbel",
express.raw({ type: "application/json" }),
(req, res) => {
const sigHeader = req.get("X-dBel-Signature") || "";
const tsHeader = req.get("X-dBel-Timestamp") || "";
const ts = Number(tsHeader);
if (!Number.isFinite(ts)) return res.status(401).end();
if (Math.abs(Date.now() / 1000 - ts) > TOLERANCE)
return res.status(401).end();
if (!sigHeader.startsWith("sha256=")) return res.status(401).end();
const expected = crypto
.createHmac("sha256", process.env.DBEL_WEBHOOK_SECRET)
.update(`${ts}.`)
.update(req.body) // raw Buffer
.digest("hex");
const received = sigHeader.slice("sha256=".length);
const a = Buffer.from(expected);
const b = Buffer.from(received);
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
return res.status(401).end();
}
const payload = JSON.parse(req.body.toString());
// … process payload …
res.status(200).end();
},
);Go
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"io"
"net/http"
"os"
"strconv"
"strings"
"time"
)
const tolerance = 300 // seconds
func handleWebhook(w http.ResponseWriter, r *http.Request) {
rawBody, _ := io.ReadAll(r.Body)
sigHeader := r.Header.Get("X-dBel-Signature")
tsHeader := r.Header.Get("X-dBel-Timestamp")
ts, err := strconv.ParseInt(tsHeader, 10, 64)
if err != nil {
http.Error(w, "", http.StatusUnauthorized); return
}
if abs(time.Now().Unix()-ts) > tolerance {
http.Error(w, "", http.StatusUnauthorized); return
}
if !strings.HasPrefix(sigHeader, "sha256=") {
http.Error(w, "", http.StatusUnauthorized); return
}
mac := hmac.New(sha256.New, []byte(os.Getenv("DBEL_WEBHOOK_SECRET")))
mac.Write([]byte(tsHeader + "."))
mac.Write(rawBody)
expected := hex.EncodeToString(mac.Sum(nil))
received := strings.TrimPrefix(sigHeader, "sha256=")
if !hmac.Equal([]byte(expected), []byte(received)) {
http.Error(w, "", http.StatusUnauthorized); return
}
// … process payload …
w.WriteHeader(http.StatusOK)
}
func abs(x int64) int64 { if x < 0 { return -x }; return x }4. Fetching the recording
recordingUrl in the payload is https://dbel.ai/api/calls/{callId}/recording. It's:
- Permanent — works for the lifetime of the call row, no expiry.
- Authenticated — every fetch requires
Authorization: Bearer <ApiToken>(workspace-scoped, generated in the Developer section alongside webhook secrets). - Streaming + range-aware — supports
Range: bytes=…for partial downloads and audio scrubbing.
curl -L \
-H "Authorization: Bearer $DBEL_API_TOKEN" \
-o "$CALL_ID.ogg" \
https://dbel.ai/api/calls/$CALL_ID/recordingAudio format: OGG/Opus mono, voice-rate. Most decoders (ffmpeg, Audacity, browser <audio>, transcription services) accept it directly.
If the recording is deleted (for example, when its workspace is deleted), the URL returns 404 immediately — that's the intended behavior. Re-fetch always reflects current state.
5. Retries + idempotency
We send up to 3 attempts per delivery:
- Initial attempt
- Retry after 1s if the first failed with 5xx or a connection error
- Retry after 2s more if the second failed with 5xx or a connection error
Any response that is not 2xx or 5xx is terminal — including 4xx and 3xx. We do not follow redirects, so give us the final URL (an http→https or trailing-slash redirect fails every delivery). A failed delivery is not re-sent later. Fix your handler; the next call's webhook arrives as normal.
All 3 attempts share the same X-dBel-Delivery UUID. Use this for dedup: keep a small ledger of recently-seen delivery IDs and drop duplicates.
6. Rate limits
Two rate limits apply to every recording fetch. Each allows 10 requests in any 10-second window:
- Per workspace — recording fetches only. Dashboard playback and API fetches share this limit.
- Per user — every authenticated request made as the same user (with their login or their API token), on any endpoint. It is checked first.
In practice the ceiling is about 1 request per second. (Each limit also has a 100-per-minute window, but the 10-second window always trips first.)
A 429 Too Many Requests from either limit carries a Retry-After header: the number of seconds to wait. The per-workspace 429 has an empty body. The per-user 429 has a Problem Details body with code RATE_LIMIT_EXCEEDED. Wait at least Retry-After seconds, then retry.
For batch workflows (e.g. "download last night's 1,000 recordings"), send no more than one request per second — one every 1.2 seconds leaves headroom. Don't run other API calls as the same user at the same time: they draw from the same per-user limit.
7. Common pitfalls
- Re-stringifying the body before verification — JSON serialization isn't deterministic. Always verify against the raw bytes you received.
- Using
request.json()only — most frameworks discard the raw body once it's parsed. Capture it first, then parse. - Treating
4xxlike5xxand expecting retries — we don't retry4xxor3xx. Your endpoint must return 2xx (or 5xx if you want a retry). - Forgetting timestamp tolerance — a clock-skewed customer machine will reject every request. Sync to NTP. Tolerance is 5 min by default.
8. Best practices
- Verify + queue + ack quickly. Return 2xx within a few seconds — long-running processing should happen in your own job queue. Slow handlers hit our 10-second HTTP timeout and get retried unnecessarily.
- Idempotency on your side. Index your CRM lookups by
callIdordeliveryIdso retries don't create duplicates. - Rotate the secret periodically. Generating a new secret revokes your previous one, and every call that ends after that is signed with the new secret — update both your verifier and your secret manager in the same deploy.
- Test before going live.
webhook.sitegives you a one-shot URL that prints headers + body for every request. Or run your own local listener withngrok http <port>.