Events
Webhooks
Receive signed, retried webhook events for email, contact and domain activity.
Add endpoints under Webhooks in the dashboard and choose which events each receives.
Events
email.sent, email.delivered, email.delivery_delayed, email.bounced, email.complained, email.opened, email.clicked, email.failed, email.received, contact.created, contact.updated, contact.deleted, domain.created, domain.verified, domain.deleted.
Payload
{
"id": "evt_3kq9...",
"type": "email.delivered",
"created_at": "2026-10-20T10:15:05.000Z",
"data": { "email_id": "msg_5b1f...", "from": "Acme <billing@mail.acme.com>", "to": ["ada@example.com"], "subject": "Your receipt", "status": "delivered" }
}
Headers
| Header | Value |
|---|---|
x-stackemails-event |
Event type |
x-stackemails-event-id |
Unique event id. Use it to deduplicate |
x-stackemails-delivery-attempt |
1–6 |
x-stackemails-timestamp |
Unix seconds |
x-stackemails-signature-v2 |
t=<unix>,v1=<hex hmac> |
Verifying signatures
v1 is the hex HMAC-SHA256 of ${t}.${rawBody} using your webhook secret (shown on the Webhooks page). Reject events whose timestamp is more than five minutes old.
import { verifyWebhook } from "stackemails";
const raw = await req.text();
const ok = await verifyWebhook(raw, req.headers.get("x-stackemails-signature-v2"), process.env.STACKEMAILS_WEBHOOK_SECRET!);
Without the SDK (Node.js):
import crypto from "node:crypto";
function verify(raw, header, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${raw}`).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
Retries
Respond with any 2xx within 10 seconds. Otherwise the delivery is retried after 30 s, 2 min, 10 min, 1 h and 6 h (six attempts in total). Redirects are not followed. Every attempt is visible on the endpoint's page, where you can also redeliver an event.
Endpoints must be public HTTPS URLs; private network addresses are rejected.