Email webhooks for bounces, complaints and delivery
Know what happened to every email without polling: TrivSend calls your app when an email is accepted, delayed, bounced, marked as spam, opened, clicked or received. Every call is signed, retried when your app is down, and can be sent again from the dashboard.
Start free · Webhooks in the docs
The events
| Event | When |
|---|---|
email.sent | The recipient's server accepted the email |
email.delivery_delayed | A temporary failure; TrivSend keeps retrying |
email.bounced | The address doesn't exist or refused it; it is now suppressed |
email.complained | The recipient marked it as spam; the address is now suppressed |
email.failed | Gave up after all retries, or a one-time code expired before it left |
email.suppressed | Not sent, because the recipient is on your suppression list |
email.opened, email.clicked | With open and click tracking on |
email.received | Mail arrived at your domain (inbound email) |
There are also events for contacts, domains, topics and the suppression list. A bounce looks like this:
{
"type": "email.bounced",
"created_at": "2026-10-22T09:15:10.000Z",
"data": {
"email_id": "3f2a1c9e-7b4d-4e8a-9c1f-2d6b8a0e5f71",
"to": ["user@example.com"],
"subject": "Your sign-in code",
"tags": { "category": "otp" },
"bounce": { "type": "Permanent", "message": "550 5.1.1 user unknown", "status": "5.1.1" }
}
}Not sure what a bounce code means? Look it up in bounce codes explained.
Create one
In the dashboard under Webhooks, or with the API:
curl -X POST https://api.trivsend.com/webhooks \
-H "Authorization: Bearer $TRIVSEND_API_KEY" -H "Content-Type: application/json" \
-d '{"endpoint": "https://example.com/hooks/trivsend", "events": ["email.bounced", "email.complained", "email.failed"]}'The response includes a signing_secret (whsec_...), shown once.
Verify the signature
Every request is signed with the open Standard Webhooks scheme, so any Standard Webhooks library works, as do TrivSend's SDKs. Use the raw body, before any JSON parsing:
// Node.js
const event = trivsend.webhooks.verify({
payload: rawBody,
headers: { id: req.header("webhook-id"), timestamp: req.header("webhook-timestamp"), signature: req.header("webhook-signature") },
webhookSecret: process.env.TRIVSEND_WEBHOOK_SECRET,
});# Python
event = verify_webhook(request.get_data(), request.headers, os.environ["TRIVSEND_WEBHOOK_SECRET"])// PHP
$event = \TrivSend\Webhook::verify(file_get_contents('php://input'), getallheaders(), getenv('TRIVSEND_WEBHOOK_SECRET'));Each one rejects a wrong signature and a timestamp more than 5 minutes old, which stops replayed requests. Full examples: Node.js, Python, PHP.
Built so you don't miss one
- Retries: a failed delivery is tried again after 5 seconds, 5 minutes, 30 minutes, then 2, 5, 10 and 10 hours.
- No duplicates: a retried event keeps its
webhook-id, so your app can ignore one it has already handled. - History: every attempt is logged with your app's response code, the start of its reply and how long it took. Click an event in the dashboard to see it.
- Replay: send one event again, or every failed event from the last 7 days with one button, after you fix your endpoint.
- Test events: Send a test event posts a signed sample to your endpoint and shows what it answered, before any real mail goes out.
Reply with any 2xx within 15 seconds, and do slow work after replying or in a queue. Webhooks are included in every plan. Free for 3,000 emails a month (pricing).
Also see: Inbound email · Transactional email · OTP email