Set up a destination
You configure alert webhooks in the Business Console, not through the API. Members who can manage organization settings can add, change and test destinations.1
Add the destination
In Organization settings > Team notifications, add an Alert webhook destination with your endpoint’s URL.
The URL must use
https:// and resolve to a public address.2
Store the signing secret
Didit shows the full signing secret, which starts with
whsec_, only once.
Store it now: afterwards the console shows only its last four characters.3
Route alerts to it
Adding a destination does not send anything to it yet.
Add the destination to the routing rules of the alerts you want it to receive.
4
Send a test
Click Send test to send an
alert.test alert, and check that your endpoint accepts it.Alert types
Payload
Every alert is aPOST with a JSON body.
Didit sends the body as compact JSON with its keys sorted.
This example is formatted for reading:
data always contains:
event: the event key, for examplesession_in_review.labelandvalue: what the alert is about, for exampleSessionand#1042.
data:
alert.billing.autorefill_failedaddspaused, a boolean that istruewhen auto-refill is now paused until you update the card.alert.service.degradedandalert.service.recoveredaddservice,status,incident_id,service_name,state,affected,country_name,started_at,resolved_at,duration_minutes,titleandbody.statusisdegradedordownonalert.service.degraded, andrecoveredonalert.service.recovered.serviceuses the service keys ofGET /v3/status/, andincident_idmatches an incidentidthere.
webhook_type values and data keys you do not recognize, so new ones do not break your endpoint.
Request headers
Verify the signature
X-Signature-V2 is the hex-encoded HMAC-SHA256 of the string <X-Timestamp>.<raw body>, keyed with your destination’s signing secret.
- Use the full secret exactly as Didit showed it, including the
whsec_prefix. - Sign the raw request bytes as you received them. Parsing the JSON and serializing it again can change the bytes and break the check.
- Compare the signatures in constant time.
- Reject a request whose
X-Timestampis more than 5 minutes away from your clock. Didit signs every attempt, including each retry, with a fresh timestamp, so this window never rejects a genuine retry. - Answer a failed check with
400. A401,403,404or410response marks the destination for reconnection (see Retries).
Node.js (Express)
Python (Flask)
Rotate the signing secret
You rotate the secret on the destination in Team notifications. Didit shows the new secret once and signs every later attempt with it, including retries of alerts created before the rotation. The old secret stops working at once. There is no overlap period, and no header carries a signature made with the previous secret. Deploy the new secret to your endpoint as soon as you rotate it.Retries
Didit treats any2xx response as delivered.
Each attempt waits up to 5 seconds for your response and does not follow redirects.
Didit retries an alert after a timeout, a connection failure, a 5xx response, or a 408, 425 or 429 response.
It retries up to 5 times, over about 24 hours:
Every other response is final, including
3xx and any other 4xx.
A test sent with Send test gets a single attempt and is never retried.
A 401, 403, 404 or 410 response also marks the destination for reconnection: the console shows it with a Reconnect status.
So does a URL that resolves to a private or otherwise blocked address when Didit sends.
Didit keeps sending new alerts to the destination, and it becomes active again after the next successful delivery or when you update its URL.
Recent notifications in Team notifications lists each delivery with its result, and you can retry a failed delivery from there.
Related
- Verification webhooks: session, entity and transaction results for your application.
- Service status: the public feed behind
alert.service.degradedandalert.service.recovered. - Manual review: what to do with a verification in review.