How Webhooks Work
1
Event Occurs
Email is delivered, opened, clicked, etc.
2
We Send POST
HTTP POST to your endpoint
3
You Verify
Validate signature for security
4
Process Event
Update your database, trigger actions
Event Types
Creating a Webhook
Create a webhook endpoint to receive events:Response
response.json
Webhook Payload
Each webhook request includes the following structure:webhook-payload.json
Click Event Example
click-event.json
Bounce Event Example
bounce-event.json
Verifying Webhook Signatures
Each webhook request includes a signature in theX-Unosend-Signature header:
verify-webhook.ts
Complete Webhook Handler
Retry Logic
If your endpoint returns a non-2xx status code, we’ll retry the webhook:- 1st retry: 1 minute after failure
- 2nd retry: 5 minutes after failure
- 3rd retry: 30 minutes after failure
- 4th retry: 2 hours after failure
- 5th retry: 8 hours after failure
Managing Webhooks
List Webhooks
cURL
Update a Webhook
cURL
Delete a Webhook
cURL
Best Practices
- ✓ Always verify signatures to ensure webhooks are from Unosend
- ✓ Return 200 quickly and process events asynchronously
- ✓ Handle duplicates - use event ID for idempotency
- ✓ Log all events for debugging and auditing
- ✓ Use HTTPS for your webhook endpoint