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

EventWhen
email.sentThe recipient's server accepted the email
email.delivery_delayedA temporary failure; TrivSend keeps retrying
email.bouncedThe address doesn't exist or refused it; it is now suppressed
email.complainedThe recipient marked it as spam; the address is now suppressed
email.failedGave up after all retries, or a one-time code expired before it left
email.suppressedNot sent, because the recipient is on your suppression list
email.opened, email.clickedWith open and click tracking on
email.receivedMail arrived at your domain (inbound email)

There are also events for contacts, domains, topics and the suppression list. A bounce looks like this:

json
{
  "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:

bash
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:

js
// 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
# Python
event = verify_webhook(request.get_data(), request.headers, os.environ["TRIVSEND_WEBHOOK_SECRET"])
php
// 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

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