Webhooks: we send you a message as soon as something happens
A webhook is an address on your system. When something happens to your email, we send a notification there with the details.
What you use them for
You can ask for the status of a message over and over. With a webhook we send it to you the moment it changes. That saves requests, and you know sooner.
- Report an order as undeliverable as soon as the confirmation bounces.
- Tick a box 'email does not work' in your customer records as soon as an address lands on your suppression list.
- Track in your own dashboard which email arrives.
- Take an address off your list as soon as the recipient reports your email as spam.
If you hit the API request limit often, a webhook is probably handier than asking again and again.
What we report
Seven events are about your email, seven about your domain name. Per webhook address you tick which ones you want to receive. Such an address is called an endpoint in technical terms. Tick nothing and that address receives nothing. You also choose per webhook address which of your domain names it applies to: all of them, including domain names you add later, or only the ones you choose. That way the notifications of your web shop can go to one system and those of your newsletter to another.
| Event | When |
|---|---|
| message.delivered | the receiving server accepted the message |
| message.bounced | the message came back and cannot be delivered at all; the address goes on your suppression list |
| message.deferred | the receiving server is holding it back; we try again |
| message.suppressed | not sent, because the address was on your suppression list |
| message.opened | the tracking pixel of the message was fetched |
| message.clicked | a link in the message was clicked |
| message.complained | the recipient reported the message as spam; only when the receiving provider passes that on to us |
| domain.verified | all DNS records of a domain name are in order |
| domain.dns_problem | a DNS record is missing or differs |
| domain.dns_resolved | all DNS records of a domain name are back in order |
| domain.quota_warning | a domain name has used 80% or 90% of its monthly limit; one notification per threshold per month |
| domain.quota_reached | a domain name has used all of its monthly limit; one notification per month |
| domain.bounce_spike | a large share of the messages of a domain name came back; one notification per spike |
| domain.sending_limit_reached | a domain name reached its daily limit and mail was held back; one notification per day |
- message.delivered
- the receiving server accepted the message
- message.bounced
- the message came back and cannot be delivered at all; the address goes on your suppression list
- message.deferred
- the receiving server is holding it back; we try again
- message.suppressed
- not sent, because the address was on your suppression list
- message.opened
- the tracking pixel of the message was fetched
- message.clicked
- a link in the message was clicked
- message.complained
- the recipient reported the message as spam; only when the receiving provider passes that on to us
- domain.verified
- all DNS records of a domain name are in order
- domain.dns_problem
- a DNS record is missing or differs
- domain.dns_resolved
- all DNS records of a domain name are back in order
- domain.quota_warning
- a domain name has used 80% or 90% of its monthly limit; one notification per threshold per month
- domain.quota_reached
- a domain name has used all of its monthly limit; one notification per month
- domain.bounce_spike
- a large share of the messages of a domain name came back; one notification per spike
- domain.sending_limit_reached
- a domain name reached its daily limit and mail was held back; one notification per day
message.opened and message.clicked only exist for domain names with tracking on. Tracking is opt-in and off by default; with it off, nothing arrives on that webhook. And an open always counts too high. Apple Mail Privacy Protection fetches the tracking pixel without anyone reading the message.
What we deliberately do not report
- The hops inside our own network. A webhook reports the outcome, not the route.
- The spam score of a message.
- The content of your email. What does come along: the subject, the sender, the recipient, the status and what the receiving server said back.
What the request looks like
Every request is a POST with JSON in it. At the top sit four headers: the type of event, the number of this delivery, which attempt it is and the signature. A header is an extra line at the top of the request, separate from the content.
The headers
POST https://yoursystem.com/hooks/sendpier
Content-Type: application/json
User-Agent: SendPier-Webhooks/1.0
X-SendPier-Event: message.delivered
X-SendPier-Delivery: 4821
X-SendPier-Attempt: 1
X-SendPier-Signature: t=1755172800,v1=1f3a…
What is in the request
Three examples with the same fields. Only data.status, data.smtp_status and data.detail differ; the other fields are always there in the same shape.
Delivered
{
"id": "evt_4821",
"event": "message.delivered",
"account_id": 8,
"occurred_at": "2026-08-17T11:59:00+00:00",
"data": {
"message_id": "msg_5f1c9a0b7e2d…",
"spid": "spid_abc123",
"domain": "yourdomain.com",
"from": "noreply@yourdomain.com",
"to": "recipient@example.org",
"subject": "Your order",
"status": "delivered",
"smtp_status": "250",
"remote_host": "mx.voorbeeld.nl",
"detail": "2.0.0 OK"
}
}
Bounced
{
"id": "evt_4821",
"event": "message.bounced",
"account_id": 8,
"occurred_at": "2026-08-17T11:59:00+00:00",
"data": {
"message_id": "msg_5f1c9a0b7e2d…",
"spid": "spid_abc123",
"domain": "yourdomain.com",
"from": "noreply@yourdomain.com",
"to": "recipient@example.org",
"subject": "Your order",
"status": "bounced",
"smtp_status": "550",
"remote_host": "mx.voorbeeld.nl",
"detail": "5.1.1 The email account that you tried to reach does not exist"
}
}
Deferred
{
"id": "evt_4821",
"event": "message.deferred",
"account_id": 8,
"occurred_at": "2026-08-17T11:59:00+00:00",
"data": {
"message_id": "msg_5f1c9a0b7e2d…",
"spid": "spid_abc123",
"domain": "yourdomain.com",
"from": "noreply@yourdomain.com",
"to": "recipient@example.org",
"subject": "Your order",
"status": "deferred",
"smtp_status": "451",
"remote_host": "mx.voorbeeld.nl",
"detail": "4.7.1 Greylisted, try again later"
}
}
Your message content is not in it; a webhook is only about the delivery.
Any sender address on a verified domain name can be used to send email
Verifying the signature
X-SendPier-Signature reads t=<unixtime>,v1=<hex>. That hex is the HMAC-SHA256 over the literal text <unixtime>.<body>. That is a calculation which only gives the same result if you hold the same secret as we do. The secret starts with whsec_ and sits on the detail page of your webhook. If you renew the secret, the old one keeps working for another 24 hours, and in that time the header carries two signatures, the new one first: t=<unixtime>,v1=<new>,v1=<old>. So look at every v1 and accept the request if one of them matches.
Python
import hashlib, hmac, time
def valid(secret, header, body, leeway=300):
timestamp = None
signatures = []
for part in header.split(","):
if "=" not in part:
continue
name, value = part.strip().split("=", 1)
if name == "t":
timestamp = value
elif name == "v1":
signatures.append(value)
if timestamp is None or not signatures:
return False
try:
moment = int(timestamp)
except ValueError:
return False
if abs(time.time() - moment) > leeway:
return False
expected = hmac.new(
secret.encode(), f"{timestamp}.{body}".encode(), hashlib.sha256
).hexdigest()
matched = False
for signature in signatures:
if hmac.compare_digest(expected.encode(), signature.encode()):
matched = True
return matched
Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';
const TOLERANCE_SECONDS = 300;
function signatureIsValid(secret, header, body, tolerance = TOLERANCE_SECONDS) {
let timestamp = null;
const candidates = [];
for (const part of header.split(',')) {
const index = part.indexOf('=');
if (index === -1) {
continue;
}
const key = part.slice(0, index).trim();
const value = part.slice(index + 1);
if (key === 't') {
timestamp = value;
} else if (key === 'v1') {
candidates.push(value);
}
}
if (!timestamp || candidates.length === 0) {
return false;
}
if (!(Math.abs(Date.now() / 1000 - Number(timestamp)) <= tolerance)) {
return false;
}
const expected = Buffer.from(
createHmac('sha256', secret).update(`${timestamp}.${body}`).digest('hex'),
'utf8'
);
let valid = false;
for (const candidate of candidates) {
const given = Buffer.from(candidate, 'utf8');
if (given.length === expected.length && timingSafeEqual(expected, given)) {
valid = true;
}
}
return valid;
}
The signature: four things to get right
- Look at every v1 in the header. After a new secret there are two in it for 24 hours, and one that matches is enough. A check that reads only one v1 is not safe: our older examples read the last one and reject every request as soon as you enter the new secret, and a check of your own that takes the first one already fails when you renew.
- Calculate the signature over the raw text that came in. Do not do it over an object you turned back into JSON yourself: one shifted space and the signature no longer matches.
- Compare the signatures, each v1 on its own, with a function that always takes the same amount of time. A plain comparison stops at the first difference, and so gives away how many characters of a guess were right.
- Check the timestamp. Without that check, someone can send an intercepted request to you again later, for as long as the secret has not been replaced. The signature itself does not expire.
The order in your receiver
- Read the raw text, before your framework turns it into JSON.
- Verify the signature. If it does not match: answer 400 and process nothing.
- Check whether you already know this id. If so: answer 200 and stop.
- Put the event on your own queue.
- Answer 200.
- Process it afterwards, outside the request.
Answer with a 2xx first and process afterwards; our timeout is ten seconds.
When your system is down for a while
Every 2xx counts as success. Anything else, and every connection that fails to open, counts as a failure. Attempt 1 goes straight away; after that we wait longer each time.
| Attempt | Wait before it |
|---|---|
| 2 | 1 minute |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
| 6 | 8 hours |
Six attempts spread over a good ten hours. The short waits at the start catch a restart of your server. The long ones at the end bridge an outage of half a working day. If the sixth attempt fails too, that delivery shows as failed in the log. We only pause your webhook address when it gave nothing but errors for more than ten hours. If it does succeed in between, it stays on. When we pause, we cancel the pending deliveries and send the administrators a notification.
The delivery log
The panel lists every attempt we made. You see the status code your system returned and how long the answer took. How far back you can look depends on your plan. We really delete a settled line after ninety days. You can offer a failed delivery again yourself.
What the limits are
- 1 webhook address free, 10 on every paid plan
- Keep the list short even when you may have ten. Every event goes to every address listening for it and for that domain: if all ten are on all domain names, that is ten requests per delivered message. If your plan goes down, the oldest webhooks that are on stay on and we switch off the rest; nothing is deleted, and on a higher plan they come back on, up to the number that plan allows.
- Https only
- An http address is refused when you enter it. An event carries email addresses and subject lines. The signature only proves the request came from us; it does not make the content unreadable to others. That is why we require https.
- Ten seconds to answer
- Take longer and it counts as failed, and you get the same event again. Let your webhook address do nothing but accept, verify and store.
- No guarantee of exactly one delivery
- We queue every event only once, but a late answer earns you a repeat. If you have seen an id before, skip the notification. Use occurred_at, the moment it happened, to determine the order: a 'delivered' notification can arrive after 'deferred' because of a repeat, while it happened earlier.
- Missed events can be resent up to 24 hours back
- If we pause your webhook address because it gave nothing but errors for more than ten hours, we do not send the events of the pause again by ourselves. Resuming is up to you. After that you can have them sent again, up to 24 hours back and within what your plan shows. That can be done once per pause, with at most 10,000 events per request. What has already been delivered does not go out again.
- Opens and clicks need Clipper or Fleet
- Whether a message was delivered, deferred or bounced we report on every plan, including Free. Who opened the message and who clicked we only measure from Clipper on. Tracking is opt-in per domain name and off by default.
Switch on your first webhook
Create an account, verify your domain name and enter your https address. Even the free plan gets one.