Webhooks
Receive contact and call events at your own HTTPS endpoint, signed with HMAC-SHA256, with retries and a delivery log.
A webhook is a message Dhvanee sends to your server when something happens, so you do not have to keep asking. Each message is an HTTPS POST with a JSON body and a signature you can check to be sure it really came from Dhvanee.
Set one up
- 1. In Settings → Developer access → Webhooks, click to add a webhook.
- 2. Enter the HTTPS address of your endpoint and tick the events you want. You need at least one event.
- 3. Create it, then copy the signing secret now. It is shown once and cannot be shown again.
- 4. Build your endpoint to verify the signature and answer quickly (see below).
- To change the address or events, or to rotate the secret, create a new webhook and delete the old one.
Creating a webhook sends nothing to your address. The first message arrives when a chosen event happens.
What your address must be
httpsonly, with no user name or password in it, between 12 and 2000 characters.- A public address. Names such as
localhost, ending in.local,.internalor.localhost, and addresses that resolve to private or internal networks are refused. The address is checked again before every delivery. - The refusals read
Webhook URL must be an HTTPS address,Webhook host must be publicly routable,Webhook host could not be resolvedand, for an unknown event name,Webhook event name is not supported.
Events
| Event | Sent when |
|---|---|
created | A contact is created. |
field_change | A contact's details change. |
merged | Two contacts are merged. |
imported | Contacts are brought in by an import. |
sync | A CRM sync creates or updates a contact. |
note | A note is added to a contact. |
consent | You can subscribe to it, but Dhvanee does not send it yet. |
task | A task on a contact is marked done. |
call_started | An outbound call has been dialled. |
call_ended | An outbound call finishes, or you stop it. |
call_analyzed | The analysis of a finished call is ready. |
- Contact events fire for changes from the dashboard, imports, CRM sync and the Contacts API alike.
- Call events fire for every outbound call of the workspace: calls placed with
POST /v1/callsand calls made by campaigns. For an API call,call_idis the idPOST /v1/callsreturned, soGET /v1/calls/{id}finds it. For a campaign call thecall_ididentifies that call but is not available throughGET /v1/calls.
What a delivery looks like
Each delivery is a POST to your address with the headers below and a compact JSON body.
| Header | Meaning |
|---|---|
Content-Type | application/json |
X-Dhvanee-Event | The event name, for example call_ended. |
X-Dhvanee-Delivery | The id of this delivery. It stays the same on every retry of the same delivery. |
X-Dhvanee-Timestamp | Unix time in seconds when this attempt was signed. It changes on every retry. |
X-Dhvanee-Signature | sha256= followed by the hex HMAC-SHA256 signature (see below). |
curl -sS -X POST "YOUR_ENDPOINT_URL" \
-H "Content-Type: application/json" \
-H "X-Dhvanee-Event: call_ended" \
-H "X-Dhvanee-Delivery: 9f3c0d2e-0000-4000-8000-000000000001" \
-H "X-Dhvanee-Timestamp: 1730000000" \
-H "X-Dhvanee-Signature: sha256=3b1f..." \
-d '{"id":"c0a8...","type":"call_ended","tenant_id":"...","call_id":"6f1c...","created_at":"2026-11-04T12:00:00+00:00","data":{"call":{"id":"6f1c...","agent":"ff29...","to":"+919876543210","from":"+918000000000","status":"completed","duration":42,"transcript":null}}}'This is the request your endpoint receives, not one you send.
Body of a call event
{
"id": "c0a8e1d2-0000-4000-8000-000000000002",
"type": "call_ended",
"tenant_id": "WORKSPACE_ID",
"call_id": "6f1c0d2e-0000-4000-8000-000000000003",
"created_at": "2026-11-04T12:00:00+00:00",
"data": {
"call": {
"id": "6f1c0d2e-0000-4000-8000-000000000003",
"agent": "AGENT_ID",
"to": "+919876543210",
"from": "+918000000000",
"status": "completed",
"duration": 42,
"transcript": null
}
}
}data.callis the same call objectGET /v1/calls/{id}returns, as it was when the event happened. Atcall_starteditsstatusisin_progress.call_analyzedaddsdata.summaryanddata.extracted_fieldsnext todata.call.ididentifies the event. To spot repeats, use theX-Dhvanee-Deliveryheader, notid.
Body of a contact event
{
"id": "5d2b7a10-0000-4000-8000-000000000004",
"type": "created",
"tenant_id": "WORKSPACE_ID",
"contact_id": "6f1c0d2e-0000-4000-8000-000000000005",
"created_at": "2026-11-04T12:00:00+00:00",
"data": {"via": "public_api"}
}data depends on the event. For field_change it lists which fields changed and the changes made.
Verify the signature
The signature is an HMAC-SHA256 of the timestamp, a dot, and the raw request body, computed with your signing secret as the key, written in lower-case hex and prefixed with sha256=. Always compute it over the exact bytes you received. If you parse the JSON and write it out again, the bytes change and the check fails.
import hashlib
import hmac
import time
def verify(secret: str, raw_body: bytes, timestamp: str, signature: str) -> bool:
# Refuse old or replayed deliveries.
if abs(time.time() - int(timestamp)) > 300:
return False
signed = timestamp.encode() + b"." + raw_body
expected = "sha256=" + hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature)import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(secret, rawBody, timestamp, signature) {
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const expected = "sha256=" + createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(signature);
return a.length === b.length && timingSafeEqual(a, b);
}Answering, retries and the delivery log
- Answer fast. Reply within 20 seconds (8 seconds to connect) with any status below 400, such as
200or204. Do your real work after replying. - Redirects are not followed. Give the final address.
- Failures are retried. A timeout, a connection error or a status of 400 or more counts as a failed attempt. The delivery is tried again on the next delivery run, currently about every 2 minutes, up to 8 attempts in total. After the 8th failure it is marked
failedand is not sent again. - Not instant. Events are queued and sent by that same run, so a message normally arrives within a couple of minutes, and a run sends up to 25 queued deliveries, oldest first. A bulk import can therefore be delivered over a longer time.
- At least once. The same delivery can reach you more than once, for example when your reply was slow. Treat each
X-Dhvanee-Deliveryid as single-use and keep the ones you have seen for at least 24 hours. - Order is not guaranteed when some deliveries are retried. Use
created_atin the body to put events in order. - If you delete the webhook or the workspace is suspended, deliveries still waiting are not sent.
- Delivery log. Settings → Developer access → Developer logs → Webhook Log lists recent deliveries with the endpoint, event, HTTP status, number of attempts and the last error. By default entries are kept for 24 hours on Free and Starter, 72 hours on Growth and 168 hours (7 days) on Pro and Enterprise.
Harden your endpoint
- Verify
X-Dhvanee-Signatureon the raw body before you trust anything in it. - Reject a delivery when
abs(now_unix - X-Dhvanee-Timestamp)is more than 300 seconds. Keep your server clock correct. - Compare signatures in constant time, as in the examples above.
- Ignore events you did not subscribe to, and answer unknown event types with
200. - Make your handler safe to run twice for the same delivery.