Skip to content
Try the demo

What is a webhook?

Published
Last updated
Reading time
3 minutes

Short definition

A webhook is an HTTPS request that a system sends to your address by itself when an event happens. You do not ask; the news comes to you. In BirAsistan the request is signed, and the receiver checks the signature before accepting the event.

An event happens and a signed request reaches your endpoint

When a call ends or a recording is ready, BirAsistan sends an HTTPS request to your registered endpoint. Events also report when outputs such as a call recording and a call transcript are ready. The request carries a body describing the event and three headers: BirAsistan-Signature holds the timestamp and signature, BirAsistan-Delivery-Id identifies each delivery attempt, and BirAsistan-Event-Id identifies the event itself. The body is in CloudEvents format and names the event type, for example call.ended.

The receiver checks the signature first. It separates the timestamp and signature from the header and checks that the timestamp is no more than 300 seconds from the receiver's own clock. Then it writes the timestamp, a dot and the raw body received one after another, computes HMAC-SHA256 with the secret, and compares the result with the header value in constant time. If they do not match, the body is rejected.

If delivery fails, the request is sent again. A 2xx response is success; 408, 429, 5xx and network errors are retried. The wait starts at 10 seconds and grows to 12 hours, with an upper limit of 24 hours. The full schedule is on the webhooks page. On every attempt the timestamp, signature and delivery identifier are renewed; the event identifier and the body stay the same.

Webhook: the event envelope reaches the endpoint with a signature header, and the receiver verifies it.Left to right: the sender, an envelope carrying three headers and an event body, and the receiver that verifies the signature. With a matching signature the event is accepted.

When you want the news instead of asking for it

A webhook fits when you want to start work right after an event: writing a record in your own system when a call ends, or triggering a flow once a recording and transcript are ready. Otherwise you would have to keep asking for the status. Event types such as recording.ready and transcript.ready are written out in the event catalog.

A webhook does not fully replace querying. Events may arrive out of order; a late call.started does not undo the state set by call.ended. If an event was missed, you read the current state through the REST API.

Three rules matter on the receiving side. The signature is verified on the raw body received, not on a rewritten one. The same event can arrive twice; a valid signature does not show that it was not processed before, and a repeat is recognized from the event identifier. The event identifier is written to a durable record, and 2xx is returned only after the event has been durably accepted.

How it differs from a REST API call

Both carry data between two systems; the difference is who calls whom, and when.

Webhook
BirAsistan calls your address when an event happens. The news comes to you; you do not ask.
REST API
You call BirAsistan when you need something. This is how you read the current state and any event you missed.

Webhooks in BirAsistan

In BirAsistan an endpoint is registered over HTTPS only and confirms access with a verification request; sending to internal addresses is not possible. Each endpoint has its own signing secret, and that secret is not an API key. While a secret is being rotated, the old and new secret can both be accepted for a short, defined window. After the last attempt a failed delivery record is created; a manual resend uses the same event identifier and is written to the audit record. On the webhook page you can break the signature in your browser and compare the test vector with your own verification.