Signed webhooks
Receive events in real time on your server, with HMAC SHA-256 validation against forgeries.
Available events
Receive events in real time on your server, with HMAC SHA-256 validation against forgeries.
| Field | Type | Description |
|---|---|---|
| email.sent | event | Email accepted by the MTA and handed off to the destination provider. |
| email.delivered | event | Destination provider confirmed delivery to the inbox. |
| email.bounced | event | Permanent bounce — recipient does not exist or provider policy. |
| email.complained | event | Recipient marked the email as spam. Add to suppression automatically. |
| email.opened | event | Email opened by recipient (pixel tracking). |
| email.clicked | event | Link clicked (tracking). |
| email.failed | event | Definitive failure after retries. |
| email.suppressed | event | Email blocked by the suppression list. |
| email.delivery_delayed | event | Delivery delayed (greylisting / destination rate limit). |
1. Register the endpoint
Provide a valid HTTPS URL and the list of events you want to receive. We strongly recommend registering a secret.
2. Validate the HMAC signature
Each request arrives with the X-CoffeeMail-Signature header containing HMAC SHA-256 of the raw body. Use coffeemail.webhooks.verifySignature() in your handler.
3. Respond in < 5s
Respond 200 OK quickly. If you need to process asynchronously, enqueue locally and return 202. Slow workloads trigger exponential retries.
4. Implement idempotency
Each payload includes a unique event id. Persist it in your database to discard duplicates. Use upsert by id.
5. Test the endpoint
Use POST /v1/product/webhooks/:id/test to fire a simulated event. The endpoint receives a fictitious payload with a valid signature.