Signed webhooks: delivery and verification
BirAsistan sends events to your endpoint as signed HTTPS requests. You verify the signature over the raw body and recognize a repeated event by its id. To try a first delivery end to end, follow the quickstart; the other pages are listed on the developers page.
Delivery headers
BirAsistan-Signature- Timestamp and signature
BirAsistan-Delivery-Id- Identifies each delivery attempt
BirAsistan-Event-Id- Identifies the event and stays fixed on redelivery
Time tolerance- 300 seconds
Change the body and the signature breaks
Change one character in the body below. The signature is computed in your browser and the result updates at once.
Edit the body. Adding a line break breaks the signature too.
- 1. Split the headerWaitingTake the t and v1 values from the BirAsistan-Signature header. If the header structure or the body size is wrong, the request is rejected here.
- 2. Check the timestampWaitingThe timestamp must be within 300 seconds of your clock. In this sample the clock is fixed to the signing time.
- 3. Compute the signatureWaitingWrite the timestamp, a dot and the raw body in a row, and compute HMAC-SHA256 with the secret.
- 4. CompareWaitingCompare the computed signature with the v1 value in the header in constant time. If they differ, reject the body.
Computing.
Sample secret. The computation runs in your browser.
Delivery and retries
One account's slow endpoint does not block delivery for other accounts.
- Endpoint registration. An endpoint is registered over HTTPS and confirms access with a verification challenge. Delivery to internal addresses is not possible.
- Response. 2xx is success. 408, 429, 5xx and network errors are retried. A permanent 4xx is reported. A 410 can be read as a signal that the endpoint is closed.
- Wait intervals. The default delivery schedule waits 10 seconds, 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours; the upper limit is 24 hours. The schedule is a product setting.
- On every attempt. Each attempt carries a new timestamp, a new signature and a new BirAsistan-Delivery-Id. The event id and the body stay the same.
- Final attempt. After the last attempt a failed-delivery record is created. A manual resend uses the same event id and is written to the audit trail; it must not repeat the earlier business effect.
Receiving the same event twice
A valid signature does not prove the event was not processed before. You recognize a repeat by its event id.
- Durable record
- Write the event id, source and account together into a durable record. Keeping the id only in memory does not stop a replay after a restart.
- Accept first, work later
- Answer 2xx after you have accepted the event durably. The business effect can follow later. If the same event arrives again, return the earlier acceptance.
- The id is fixed
- On redelivery the event id does not change. A corrective event carries a new id.
- No ordering guarantee
- A late call.started does not undo a call.ended state. If an event is missing, read the current state through the REST API.
Checklist for your endpoint
| Check | Why |
|---|---|
| Verify the raw body | The signature is computed over the bytes received, not over a parsed and rewritten body. No layer in between may change the body. |
| Check the body size | Verification looks at the header structure and the body size first; an oversized body is rejected. |
| Check the timestamp | The default tolerance is 300 seconds. A stale or far-future message is rejected; watch your clock synchronization. |
| Compare signatures in constant time | The time a comparison takes must not reveal how many characters matched. |
| Use a secret per endpoint | Every endpoint has its own signing secret. A webhook secret is not an API key. |
| Accept two secrets during rotation | While a secret is rotated you may accept the current and the previous secret for a short, clearly defined window. |
| Match the account | A signature does not authorize the work. Also check that the account id in the event matches your own record. |
| Record the event id | It is the only way to recognize a repeat; the section above has the details. |
| Use HTTPS | An endpoint is registered over HTTPS only. |
Test vector
With the same secret, timestamp and body, a helper in any of the three languages must produce the same signature. The vector is a sample; the secret is fake. The event is the call.ended envelope from the event catalog.
secret: whsec_documentation_fixture_only_not_a_real_secrettimestamp: 1796212800BirAsistan-Signature: t=1796212800,v1=b5fb7325cd10fbd668fabdb1c089693821644530a5783336303d7f86348122a6body: {"specversion":"1.0","id":"aaaaaaaa-aaaa-4aaa-8aaa-000000000003","source":"urn:birasistan:core","type":"call.ended","time":"2026-12-02T12:00:00Z","subject":"calls/22222222-2222-4222-8222-222222222222","datacontenttype":"application/json","dataschema":"https://docs.birasistan.com/schemas/v1/call-ended","tenantid":"11111111-1111-4111-8111-111111111111","traceid":"0123456789abcdef0123456789abcdef","data":{"tenantId":"11111111-1111-4111-8111-111111111111","callId":"22222222-2222-4222-8222-222222222222","endedAt":"2026-12-02T12:00:00Z","outcome":"completed","durationMs":180000,"aiActiveMs":95000,"humanActiveMs":60000,"sequence":10,"terminationReason":"completed","businessOutcome":"solved"}}- Must be accepted
- The vector as it stands.
- Must be rejected
- The body with one byte added, a wrong secret, an expired or future timestamp, a missing header and an oversized body.
- Test on the receiver as well
- A duplicate event, call events that arrive out of order and a process that crashes after the work.