Start here
Webhooks
Receive email events over HTTPS POST, verify signatures, and troubleshoot deliveries.
What are webhooks?
A webhook is an HTTP request that one service sends to another when an event occurs. You provide a URL for your application, and the sending service calls it with details about the event. Webhooks are commonly sent as POST requests.
With polling, your application checks for updates at regular intervals. With webhooks, the sending service contacts your application when an event occurs.
Your application replies with an HTTP status to acknowledge the request. If a delivery is retried, your application may receive the same event more than once.
Set up a webhook
Create a public HTTPS endpoint on port 443 that accepts POST requests. In Sendy, open Webhooks, add the endpoint URL, and select the email events you want. Save the signing secret shown when you create the endpoint.
Email events and payload
Sendy sends email.delivered, email.delayed, email.bounced, email.complaint, and email.rejected when it records a delivery status update. Sendy sends each update in an HTTP POST request with a JSON:API webhook-events resource with Content-Type: application/vnd.api+json. The message relationship carries the original email job ID. The recipient.address field is the affected address, and occurred_at is the provider event time in UTC.
POST /webhooks/sendy HTTP/1.1
Host: example.com
Content-Type: application/vnd.api+json
Sendy-Webhook-Timestamp: <unix-timestamp>
Sendy-Webhook-Signature: v1=<hex-digest>
{
"data": {
"type": "webhook-events",
"id": "evt_example",
"attributes": {
"event": "email.bounced",
"occurred_at": "2026-11-26T08:00:00Z",
"recipient": {
"type": "email",
"address": "[email protected]"
},
"failure": {
"code": "mailbox_not_found",
"retryable": false
}
},
"relationships": {
"message": {
"data": {
"type": "emails",
"id": "12345"
}
}
}
}
} For example, a bounce with failure.code set to mailbox_not_found lets you flag the address and update the record linked to the original send. Other failure codes are recipient_suppressed, hard_bounce, soft_bounce, bounce_unknown, spam_complaint, and content_rejected. When present, failure.retryable describes whether a new email send could succeed. Sendy omits it when that is unknown.
Verify the signature
- Read
Sendy-Webhook-Timestampand reject timestamps outside your replay window, for example five minutes. - Using your signing secret as the key, compute HMAC-SHA256 over the timestamp, a period, and the exact raw request body.
- Compare
v1=followed by the lowercase hexadecimal digest toSendy-Webhook-Signaturewith a constant-time comparison. - Deduplicate by the event resource’s
data.idand return a2xxresponse after accepting the event.
Node.js example
In your POST handler, pass the raw request body as a Buffer, the request headers, and the signing secret you saved in Sendy. If validation fails, return an empty 401 response. Parse the JSON only after validation succeeds.
import { createHmac, timingSafeEqual } from 'node:crypto'
export function verifySendySignature(rawBody, headers, secret) {
// Node.js exposes incoming header names in lowercase.
const timestamp = headers['sendy-webhook-timestamp']
const signature = headers['sendy-webhook-signature']
// Verification requires the signing secret for this endpoint.
if (!secret) return false
// Require one timestamp header containing Unix time in seconds, written as digits.
if (typeof timestamp !== 'string' || !/^\d{1,11}$/.test(timestamp)) {
return false
}
// Require one signature header in Sendy's v1 format: "v1=" plus 64 lowercase
// hex digits. This decodes to 32 bytes, the length of an HMAC-SHA256 digest.
if (typeof signature !== 'string' || !/^v1=[a-f0-9]{64}$/.test(signature)) {
return false
}
// Allow five minutes of clock skew and reject timestamps outside that window.
const now = Math.floor(Date.now() / 1000)
if (Math.abs(now - Number(timestamp)) > 300) {
return false
}
// Sendy signs the timestamp, a period, and the unchanged request bytes.
const expected = createHmac('sha256', secret)
.update(timestamp)
.update('.')
.update(rawBody)
.digest()
const received = Buffer.from(signature.slice(3), 'hex')
// Compare the digests without revealing how many bytes matched.
return timingSafeEqual(expected, received)
}Delivery and retries
Return HTTP 2xx within 10 seconds of the start of the HTTPS POST. An empty 204 No Content is enough. The 10-second request timeout includes connection setup. Sendy allows up to three seconds for DNS lookup before starting the request.
Sendy retries timeouts, network failures, and HTTP 408, 429, or 5xx responses. The first retry is due 15 seconds after the failed attempt. The delay doubles after each failure, up to eight attempts total, including the first. Retries use the same event ID and a fresh signature timestamp. Events may arrive out of order.
In Webhooks, select an endpoint to see its latest 50 completed deliveries from the last 30 days.