Webhooks
Get email, contact and domain events on your server, signed like Resend.
Smartletter sends an HTTPS POST to your endpoint each time something happens: an email is delivered, bounces, is opened; a contact signs up; a domain is verified. The format is Resend's (Standard Webhooks, as signed by Svix): code written for Resend webhooks works unchanged.
- Create an endpoint in Settings → Webhooks, or with
POST /webhooks(same body as Resend:endpoint,events). - Store the
signing_secret(whsec_…): it is shown once. - Answer
2xxwithin 10 seconds. Do the heavy work after answering.
Payload
Every event is { type, created_at, data }. Email events carry email_id, from, to, subject, message_id, tags; newsletter events add broadcast_id (= newsletter_id) and segment_id. When the issue runs a subject A/B test, they also carry variant (A–D) and subject is the variant's subject the recipient got.
{
"type": "email.bounced",
"created_at": "2026-10-17T09:00:00.000Z",
"data": {
"email_id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c",
"created_at": "2026-10-17T09:00:00.000Z",
"from": "Acme <[email protected]>",
"to": [
"[email protected]"
],
"subject": "Your order is on its way",
"message_id": "0107019a1b2c3d4e-5f6a7b8c-0000-0000-0000-000000000000-000000",
"tags": {
"category": "order"
},
"bounce": {
"type": "Permanent",
"classification": "hard",
"message": "Permanent/General",
"smtp_status": "5.1.1",
"diagnostic_code": "smtp; 550 5.1.1 user unknown"
}
}
}Events
| Type | When |
|---|---|
email.sent | SES accepted the message (one event per recipient). |
email.delivered | The recipient's mail server accepted it. |
email.delivery_delayed | A temporary problem; SES keeps trying. data.delay has the reason. First delay only. |
email.bounced | Refused. data.bounce.type is Permanent or Transient, classification is hard, soft, infra or ses_suppressed. |
email.complained | The recipient marked it as spam. |
email.failed | Not sent: refused by SES, or our retries ran out. data.failed.reason says why. |
email.scheduled | A transactional email was scheduled (scheduled_at), with data.scheduled_at. One per email. |
email.opened | First open of a newsletter issue by this recipient. |
email.clicked | First click in a newsletter issue by this recipient, with data.click.link. |
contact.created / contact.updated / contact.deleted | A contact was added (not by a CSV import), changed (email, name, language, status) or deleted. |
domain.created / domain.updated / domain.deleted | A sending domain was added, changed status (pending, verified, failed…) or review status, or deleted. data.review_status is none, pending, held, approved or rejected. |
sequence.entered / sequence.completed / sequence.exited | A contact entered an automated sequence, reached its end, or left it (data.exit_reason). Test runs send none. |
inbound.received | Not sent at the moment (agent inboxes are switched off). A message reached an agent inbox: data.thread_id, data.message_id, data.spam_score, sender, subject, snippet. Never for spam, quarantine or automated mail (auto-replies, bounces, lists). |
Transactional emails (POST /emails) produce email events by default. Newsletter issues produce one event per recipient, so they are opt-in: tick “Include newsletters” (include_newsletters: true), optionally for some newsletters only (segment_ids). domains keeps only the emails sent from those domains. Opens and clicks exist for newsletters only (transactional emails are not tracked), and only the first one per recipient is sent.
Verify the signature
Each request has three headers: svix-id (the message id, the same on every retry), svix-timestamp (Unix seconds) and svix-signature (v1,<base64 HMAC-SHA256 of id.timestamp.body>). Always verify on the raw body.
With the Resend SDK — smartletter takes the same call, sl.webhooks.verify(...) — or the svix / standardwebhooks packages:
import { Resend } from "resend";
const resend = new Resend(process.env.SMARTLETTER_API_KEY);
export async function POST(req: Request) {
const payload = await req.text(); // the raw body, before any JSON parsing
try {
const event = resend.webhooks.verify({
payload,
headers: {
id: req.headers.get("svix-id")!,
timestamp: req.headers.get("svix-timestamp")!,
signature: req.headers.get("svix-signature")!,
},
webhookSecret: process.env.SMARTLETTER_WEBHOOK_SECRET!, // whsec_…
});
// event.type, event.data …
return new Response("ok");
} catch {
return new Response("invalid signature", { status: 400 });
}
}Without a library:
import crypto from "node:crypto";
// secret = "whsec_…"; headers = svix-id, svix-timestamp, svix-signature; body = raw string
export function verify(secret: string, headers: Headers, body: string): boolean {
const id = headers.get("svix-id");
const timestamp = headers.get("svix-timestamp");
const signatures = headers.get("svix-signature");
if (!id || !timestamp || !signatures) return false;
// Refuse old messages (replays): 5 minutes of tolerance.
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = crypto.createHmac("sha256", key).update(`${id}.${timestamp}.${body}`).digest();
// During a rotation the header holds two signatures: "v1,<a> v1,<b>".
return signatures.split(" ").some((part) => {
const [version, sig] = part.split(",");
const given = Buffer.from(sig ?? "", "base64");
return version === "v1" && given.length === expected.length && crypto.timingSafeEqual(given, expected);
});
}Rotate the secret with POST /webhooks/{id}/signing-secret/rotate (or the dashboard). For 24 hours both secrets sign every message, so you can deploy the new one without dropping events.
Retries
| Attempt | When |
|---|---|
| 1 | at once |
| 2 | +1 min after the previous one (±20 %) |
| 3 | +5 min after the previous one (±20 %) |
| 4 | +30 min after the previous one (±20 %) |
| 5 | +2 h after the previous one (±20 %) |
| 6 | +5 h after the previous one (±20 %) |
| 7 | +10 h after the previous one (±20 %) |
| 8 | +14 h after the previous one (±20 %) |
- Only a
2xxcounts as delivered. Redirects are not followed. After 8 attempts (about 32 hours) the message is marked failed; resend it from the log or withPOST /webhooks/{id}/deliveries/{delivery_id}/retry. - Order is not guaranteed and a message can arrive twice: deduplicate on
svix-id, sort oncreated_at. - An endpoint that keeps failing is disabled: 50 failures in a row over at least a day, or 3 days of failures with no success. Owners and admins get an email; enable it again from the dashboard or with
PATCH /webhooks/{id}(status: "enabled"). - Endpoints must be public
https://URLs; private and local addresses are refused, before saving and before every attempt. - The log keeps every delivery for 30 days with its status, HTTP code, duration and the first 4 KB of your answer.
Plans
Webhooks come with the paid plans: 3 endpoints on Starter, 10 on Pro, 25 on Scale, 60 on Agency.