Skip to main content
Prelude can notify your application about events using webhooks. You can configure a webhook URL using the callback_url parameter of your request.

The event object

string
The unique identifier of the event.
string
The type of the event, possible values are:
object
The payload of the event, whose structure depends on the event type.
RFC3339 date string
The timestamp of the event creation.

Correlate events with attempts

All attempts of a verification, including retries, share the same verification_id, callback_url and correlation_id. To tell attempts apart, use the attempt id of verify.attempt or the attempt_id of verify.delivery_status. To match an attempt to your create or retry request, use request_id. verify.attempt and verify.delivery_status return the request_id of the request that started the attempt, the same value as in that request’s response. Automatic fallback attempts keep this request_id. A request that sends no message produces no event with its request_id. To list the attempts, use Get a phone verification.

How to set up your Webhook

To start receiving webhook events in your app, create and register a webhook endpoint by following the steps below. You can register and create one endpoint to handle several different event types at once, or set up individual endpoints for specific events.
1

Implement the handler

Develop a webhook endpoint function to receive event data POST requests.
2

Pass the URL

Add your webhook endpoint URL to your Verification requests to start receiving events.
3

Return OK

Return a 2xx HTTP response (for example 200 OK) to the POST request to acknowledge receipt of the event. Any 2xx status counts as success. Your endpoint must answer within 5 seconds. A slower answer counts as a failure.

Delivery guarantees

Retries

If your endpoint does not answer with a 2xx status within 5 seconds, Prelude retries the event with exponential backoff. The delay between retries grows (about 1 min, 2 min, 4 min, … up to 12 hours) and includes random jitter, so do not rely on exact times. Automatic retries stop when the event is 24 hours old. A retry that was already scheduled before this limit still runs, up to 12 hours after it. After the limit, Prelude keeps the event for 14 days and can resend it on request: contact support. After 14 days, the event is no longer available.

Ordering

Prelude does not guarantee the order of events, even for the same verification. For example, a verify.delivery_status event can arrive before the verify.attempt event of the same attempt. Do not assume that one event arrives before another. Match events by verification_id and by the attempt ID (id in verify.attempt, attempt_id in verify.delivery_status).

Duplicates

Delivery is at least once. Your endpoint can receive the same event more than once, for example when your answer arrives after the timeout. The event id stays the same across retries. Store the id of each processed event and ignore an event whose id you already processed.

Delivery Statuses

When we receive a delivery status from the carrier, we send a webhook event with the verify.delivery_status type. The status field in the payload indicates the current state of the message delivery. Here are the possible status values:
Delivery statuses are indicative, but they may not always be fully reliable. Depending on the market, a “delivered” confirmation can indicate delivery to the mobile network operator, the cell tower, or (in some cases) the end user’s handset.
Cost reconciliation can take up to 15 minutes. During this window, the billed amount may not yet reflect the final cost of the message.

undeliverable is not always final

An undeliverable or expired event has an auto_retry field:
  • true: Prelude is already sending a new attempt on the next route. Its verify.attempt and verify.delivery_status events follow within a few seconds, so you do not need to send the code another way.
  • false: no new attempt follows. Retry the verification or use your own fallback.
As with any webhook flow, keep your own timeout on the verification as a whole. It covers every channel and every case, whatever the events say.

Security

Prelude’s webhooks support the following security features:

Webhook Signature

To ensure the authenticity of the webhook events, we use a signature mechanism. The signature is a base64 URL-encoded RSASSA-PSS on the SHA256 hash of the payload. The signature is sent as a string prefixed with rsassa-pss-sha256= in the X-Webhook-Signature header of each request to your webhook endpoint. To enable the webhook signature, go to the Prelude dashboard in the Verify API->Configure->Webhooks section and generate a webhook signing key for your application. You can then verify the signature of the webhook events in your webhook endpoint and process the event only if the signature is valid.
The same signing key is used for both the Verify and Notify APIs.

Signature parameters

The signature is produced with RSASSA-PSS using the following parameters. Use them exactly when verifying:
Salt length. Prelude signs with the maximum PSS salt length, not a fixed 32 bytes. Most libraries auto-detect the salt length when verifying (OpenSSL, Go’s crypto/rsa, Node.js crypto, Ruby’s openssl, and Python’s cryptography), so you don’t need to set it. Libraries that require an explicit salt length — such as Java, Kotlin, and PHP (phpseclib) — should compute it from the key (keyBytes − hashLen − 2) rather than hardcoding 222, so it keeps working if the key size ever changes.

Verifying the signature

The public key to verify the signature is a PEM-encoded SUBJECT PUBLIC KEY INFO (SPKI / -----BEGIN PUBLIC KEY-----). For the Verify and Notify APIs you obtain it from the dashboard when you generate the signing key. In the examples below, libraries that support automatic salt-length detection (Node.js, Python, Go, Ruby, OpenSSL) need no salt configuration. Libraries that require an explicit salt length (Java, Kotlin, PHP) compute it from the key so the code keeps working across key sizes.

Signing key limits

An application has one webhook signing key. Today you cannot rotate or remove the key from the dashboard. Requests are signed only once a key exists: until then they carry no X-Webhook-Signature header, and for up to 5 minutes after you generate the key some requests can still arrive unsigned. Prelude signs each delivery attempt with the current key at the time of sending, so a retry is signed again and does not keep the key of the first attempt.

IP Whitelisting

You should whitelist the following IP addresses to ensure that your webhook endpoint receives events from Prelude: