Webhooks
A webhook tells your server when something happens: an email was delivered, a message arrived, a contact changed. Me Send sends an HTTPS POST with a JSON body to the endpoint you register.
Create a webhook
const { data } = await resend.webhooks.create({
endpoint: 'https://example.com/hooks/mesend',
events: ['email.delivered', 'email.bounced', 'email.received'],
});
console.log(data.signing_secret); // whsec_...
events is required and lists the event types you want. The endpoint must be an https URL on port 443 at a public host name: IP addresses, localhost, internal names and Me Send's own hosts are refused with 422 validation_error. Redirects are not followed.
Manage webhooks with GET /webhooks, GET /webhooks/:id, PATCH /webhooks/:id (endpoint, events, status of enabled or disabled) and DELETE /webhooks/:id. POST /webhooks/:id/signing-secret/rotate issues a new secret. All of it needs a full-access key.
The payload
Every delivery has the same envelope:
{
"type": "email.delivered",
"created_at": "2026-12-03T05:12:31.000Z",
"data": { ... }
}
and these headers: svix-id, svix-timestamp and svix-signature (the same three again as webhook-id, webhook-timestamp and webhook-signature), plus User-Agent: Me-Send-Webhooks/1.0. svix-id is stable for one event across retries, so use it to ignore duplicates: delivery is at least once.
Events
| Event | Sent when |
|---|---|
email.scheduled | An email was accepted with a future scheduled_at. |
email.sent | The delivery provider accepted the email. |
email.delivered | The recipient's mail server accepted it. |
email.delivery_delayed | The recipient's server asked for a retry later. |
email.bounced | The recipient's server refused it. |
email.complained | The recipient marked it as spam. |
email.failed | The email could not be sent. |
email.suppressed | Every recipient was on the suppression list, so nothing was sent. |
email.opened | A recipient opened it (needs open tracking). |
email.clicked | A recipient clicked a link (needs click tracking). |
email.received | A message arrived at a receiving route. |
contact.created, contact.updated, contact.deleted | A contact changed, over the API, an import, an automation or the unsubscribe page. |
contact.topics.updated | A contact's topic subscriptions changed. |
topic.created, topic.updated, topic.deleted | A topic changed. |
inbox.created, inbox.updated, inbox.deleted | An inbox changed. |
inbox.thread.created, inbox.thread.folder.updated, inbox.thread.assigned, inbox.thread.unassigned, inbox.thread.labels.updated | A thread started or changed. |
inbox.email.received, inbox.email.sent | A message was filed into, or sent from, an inbox thread. |
inbox.draft.created, inbox.draft.updated, inbox.draft.sent, inbox.draft.deleted | A draft changed. |
Those 32 are every type you can subscribe to. Me Send emits no domain.* or suppression.* events. A cancelled scheduled email and broadcast progress have no events of their own: broadcast recipients produce the ordinary email.* events, carrying a broadcast_id.
Email events
All email.* events except email.received share one shape. tags appears when the email had tags, broadcast_id and template_id when it came from a broadcast or a template.
{
"type": "email.sent",
"created_at": "2026-12-03T05:12:31.000Z",
"data": {
"created_at": "2026-12-03T05:12:30.412Z",
"email_id": "7b4f0f3c-2a64-4c3b-8f77-0c1e1c9a2d11",
"message_id": "0100018f-example-message-id",
"from": "Acme <hello@yourdomain.com>",
"to": ["ann@example.com"],
"subject": "Hello",
"tags": { "campaign": "welcome" }
}
}
email.bounced adds a bounce object. type is Permanent for a hard bounce (the address is added to your suppression list) or Transient for a soft one:
"bounce": { "message": "550 5.1.1 mailbox does not exist", "subType": "General", "type": "Permanent" }
email.clicked adds a click object:
"click": { "ipAddress": "203.0.113.7", "link": "https://yourdomain.com/welcome", "timestamp": "2026-12-03T05:20:00.000Z", "userAgent": "Mozilla/5.0" }
email.received
{
"type": "email.received",
"created_at": "2026-12-03T06:00:02.000Z",
"data": {
"email_id": "c2f0a9d4-8f0e-4b5e-9e2b-6f7d3a1b9e10",
"created_at": "2026-12-03T06:00:01.000Z",
"from": "Pat Sender <pat@example.com>",
"to": ["support@yourdomain.com"],
"cc": [],
"bcc": [],
"received_for": ["support@yourdomain.com"],
"message_id": "<abc123@example.com>",
"subject": "Help with my order",
"attachments": [{ "id": "c2f0a9d4-...-0", "filename": "note.txt", "content_type": "text/plain", "content_id": null, "content_disposition": "attachment" }]
}
}
The payload has no body: fetch it with GET /emails/receiving/:email_id.
Contact and topic events
{
"type": "contact.created",
"created_at": "2026-12-03T06:10:00.000Z",
"data": {
"id": "4a1c2f1e-...",
"audience_id": "9d3b...",
"segment_ids": ["9d3b..."],
"created_at": "2026-12-03T06:10:00.000Z",
"updated_at": "2026-12-03T06:10:00.000Z",
"email": "ann@example.com",
"first_name": "Ann",
"last_name": null,
"unsubscribed": false
}
}
contact.topics.updated carries { "email": "...", "topics": [...] } with the contact's current choices. topic.* events carry id, name, description, default_subscription, deleted, created_at and updated_at.
Inbox events
Every inbox.* event has source (api, dashboard, agent or system) and inbox_id. Thread and message events add thread_id and a thread summary (id, subject, folder, labels, read, assigned_to); message events add email_id and an email object (id, direction, from, to, cc, bcc, reply_to, subject, message_id, attachments, read, received_at). A new inbound message on a new thread sends inbox.thread.created and inbox.email.received.
Verify the signature
Me Send signs every delivery the Svix way, so resend.webhooks.verify works on it:
const event = resend.webhooks.verify({
payload: rawBody, // the exact request body, as a string
headers: { id: req.headers['svix-id'], timestamp: req.headers['svix-timestamp'], signature: req.headers['svix-signature'] },
webhookSecret: process.env.WEBHOOK_SECRET,
});
Without the SDK: the signature is v1, followed by the base64 HMAC-SHA256 of ${svix-id}.${svix-timestamp}.${body}, keyed with the secret after removing the whsec_ prefix and base64-decoding it.
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(rawBody: string, headers: Record<string, string>, secret: string) {
const { 'svix-id': id, 'svix-timestamp': timestamp, 'svix-signature': signature } = headers;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; // reject old deliveries
const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
const expected = `v1,${createHmac('sha256', key).update(`${id}.${timestamp}.${rawBody}`).digest('base64')}`;
const a = Buffer.from(expected);
const b = Buffer.from(signature);
return a.length === b.length && timingSafeEqual(a, b);
}
Verify against the raw body, before parsing it. Answer with any 2xx status once the event is stored.
Retries and replay
A delivery succeeds on any 2xx response within 15 seconds. Anything else (another status, a redirect, a timeout, a connection error) is retried, up to 8 attempts in all, waiting 1, 2, 4, 8, 16, 32 and then 64 minutes between them: about two hours from first try to last. After the last failure the event is marked failed. A webhook that is disabled or deleted stops delivering.
GET /webhooks/:id/eventslists the events sent to a webhook with theirstatus(pending,attempting,successorfailed).GET /webhooks/:id/events/:event_idreturns one event with its payload.GET /webhooks/:id/events/:event_id/attemptslists every attempt, with the HTTP status and the first 500 characters of your response.POST /webhooks/:id/events/:event_id/replaysends the event again from the start, with a fresh set of 8 attempts and the samesvix-id.