Skip to main content

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
Store the signing_secret securely - you’ll need it to verify webhooks.

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

Always verify webhook signatures to ensure requests are from Unosend.
Each webhook request includes a signature in the X-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
After 5 failed attempts, the webhook is marked as failed and won’t be retried.

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