Skip to content

Webhooks

Events pushed to your endpoint, signed, retried and in order per e-mail.

Applies to EngineCloud
View as Markdown
On this page
  1. Checking the signature
  2. Delivery
Terminal
npx @sypnia/mail webhooks create https://laespiga.co/api/mail-events --events delivered,bounced,complained

Each event is a POST with a JSON body:

JSON
{
  "id": "evt_01JD…",
  "type": "bounced",
  "createdAt": "2026-11-17T14:03:22Z",
  "email": { "id": "em_01JD…", "to": "ana@example.com", "from": "pedidos@laespiga.co", "subject": "Tu pedido #1042 está listo", "tags": { "kind": "order-ready" } },
  "bounce": { "kind": "hard", "code": "5.1.1", "message": "The email account that you tried to reach does not exist." }
}

Checking the signature

Each request carries sypnia-signature: t=<unix>,v1=<hmac-sha256> over <t>.<body> with the webhook’s secret. verifyWebhook(request, secret) from @sypnia/mail/server checks it and refuses requests older than 5 minutes.

Delivery

  • Your endpoint must answer 2xx within 10 seconds.
  • Failures are retried with backoff for 24 hours; after that the event stays in the log, marked undelivered, and mail webhooks replay sends it again.
  • Events of one e-mail arrive in order; events of different e-mails can arrive in any order. Use id to ignore duplicates.
  • A webhook that fails for 3 days in a row is paused and you are notified.

With Sypnia Run, a function in the same project can be the webhook without a public URL: --target run://mail-events.

  1. Checking the signature
  2. Delivery

    Search pages, sections and terms