How does a Webhook work?
A webhook is anHTTP POST request sent by Restoo to an HTTPS endpoint you control. The request is triggered automatically whenever an event occurs.
For additional information on Webhooks, there are a number of good resources:
- Webhooks – The Definitive Guide.
- Webhook.site is a great tool for testing webhooks.
Restoo Webhooks
Restoo Webhooks comply with the Standard Webhooks initiative. Your webhook handler must:- Be publicly accessible via HTTPS.
- Return HTTP 200 OK to acknowledge the delivery.
- Respond within 10 seconds.
- Handle retries correctly (see Retry Policy).
Headers
The request will be sent with the following HTTP headers:Example webhook headers
Payload
All webhook payloads share the same top-level structure:Example webhook payload
Retry Policy
A webhook attempt is considered failed when your endpoint:- Returns a non‑2xx code.
- Does not respond within 10 seconds.
- Is unreachable.
All retries carry the same
Webhook-Id, Webhook-Timestamp, and Webhook-Signature headers as the original attempt.
After all retries fail, the webhook is marked undeliverable.
Idempotency
Because of retries, your handler must be idempotent:- Use
Webhook-Idto detect already-processed deliveries. - Skip duplicated attempts safely.
Securing Webhooks
Webhook Signing Secret
Each Partner is assigned a unique webhook signing secret used to verify the authenticity of all webhooks sent by Restoo.- A single signing secret is generated per Partner.
- This secret is shared across all webhook deliveries associated with that Partner.
- The same secret must be used to verify every incoming webhook request.
- This secret must be kept confidential and never exposed in client-side code.
Webhook-Signature header included in each webhook request.
Webhook-Signature format
Each environment (e.g. Dev and Prod) has its own signing secret. Make sure you
are using the correct secret for the environment receiving the webhook.
How the signature is generated
Restoo generates a webhook signature following these steps:- Remove the
whsec_prefix from your signing secret provided by Restoo. - Base64-decode the signing secret.
- Build the signed content:
<Webhook-Id>.<Webhook-Timestamp>.<raw_body>. - Compute HMAC-SHA256 of the signed content with binary output.
- Base64-encode the output.
- Build the final signature by prefixing it with the version identifier (
v1,).
Example of signature generation using PHP
Verification steps
To verify the authenticity, your webhook handler must:- Read the raw request body . Must be the exact byte-for-byte body received (no parsing, no reformatting).
- Extract the following headers:
Webhook-Id,Webhook-Timestamp,Webhook-Signature. - Recompute the signature using HMAC-SHA256 with your Base64-decoded signing secret.
- Remove the
v1,prefix from the header. - Compare signatures using a constant-time comparison to prevent timing attacks.
Example of secure constant-time comparison using PHP
You may enforce a maximum timestamp age to reduce replay attacks. Make sure
this window is compatible with Restoo retry delays.
Available Webhook Events
Each event includes a structured payload describing the resource affected.
More events will be added over time. Unknown event types should be ignored safely.