Skip to content

Webhook payload and signatures

When an event happens for a webhook you created, Sender sends an HTTP request to the webhook’s URL. This page describes that request, the payload for each topic, and how to verify that a request really came from Sender.

HTTP method: POST

HeaderValue
Content-Typeapplication/json
User-AgentSender-Hook-Dispatcher
X-Sender-Hmac-Sha256The request signature. See Verifying signatures.

The body is the event’s payload as a JSON object. The body has no envelope: it does not include the topic, an event ID or a timestamp. Sender also sends no other headers that identify the event.

TopicPayload
subscribers/newSubscriber
subscribers/updatedSubscriber
subscribers/unsubscribedSubscriber
groups/new-subscriberSubscriber
groups/unsubscribedSubscriber
groups/newGroup
campaigns/newCampaign
bounces/newBounce

Sent for every subscribers/* topic and for groups/new-subscriber and groups/unsubscribed. It has the same shape as a subscriber returned by the Subscribers API.

Subscriber payload
{
"id": "z61Z7gy",
"email": "[email protected]",
"firstname": "Jane",
"lastname": null,
"phone": null,
"phone_country": null,
"created": "2025-06-05T12:55:13.000000Z",
"status": {
"email": "active",
"temail": "active"
},
"ip_address": "203.0.113.10",
"bounced_at": null,
"unsubscribed_at": null,
"location": null,
"subscriber_tags": [
{
"id": "eVnJVX",
"title": "Newsletter"
}
],
"columns": [
{
"id": "avAlVe",
"title": "First name",
"type": "text",
"default": true,
"value": "Jane"
}
],
"source": "FORM"
}

Sent for groups/new.

Group payload
{
"id": "eVnJVX",
"title": "Newsletter"
}

Sent for campaigns/new.

Campaign payload
{
"id": "bk5X5J",
"title": "November newsletter",
"subject": "What's new in November",
"from": "Sender",
"reply_to": "[email protected]"
}

Sent for bounces/new. subscriber is the same subscriber payload as above, with its status after the bounce. The payload has email_campaign_data when the bounced email was a campaign, and transactional_campaign_data when it was a transactional email.

Bounce payload (campaign email)
{
"email_id": "ep2W4y-7pn8o21-YPpLY9PR5Jy9-x7GYQ",
"subscriber": {
"id": "z61Z7gy",
"email": "[email protected]",
"status": {
"email": "bounced",
"temail": "bounced"
},
"...": "the other subscriber payload fields"
},
"email_campaign_data": {
"campaign_id": "bk5X5J",
"smtp_response": "550 5.1.1 \u003c[email protected]\u003e: Recipient address rejected"
}
}
Bounce payload (transactional email)
{
"email_id": "ep2W4y-7pn8o21-YPpLY9PR5Jy9-x7GYQ",
"subscriber": {
"id": "z61Z7gy",
"email": "[email protected]",
"...": "the other subscriber payload fields"
},
"transactional_campaign_id": "aQgA89",
"transactional_campaign_data": {
"domain_id": "dWLe7D",
"smtp_response": "550 5.1.1 User unknown",
"variables": {
"order_id": "1042"
}
}
}
FieldDescription
email_idID of the bounced email, the emailId returned when it was sent.
email_campaign_data.campaign_idID of the campaign the email belonged to.
transactional_campaign_idID of the transactional campaign.
transactional_campaign_data.domain_idID of the sending domain, or null.
transactional_campaign_data.variablesThe variables the email was sent with, as you sent them.
*.smtp_responseThe receiving server’s SMTP response.

transactional_campaign_id is only present when the email was sent from a transactional campaign (/v2/message/{id}/send), not for emails sent without a template.

Every request is signed, so you can check that it came from Sender and that the body was not changed.

HeaderX-Sender-Hmac-Sha256. Header names are case-insensitive: many frameworks give it to you as x-sender-hmac-sha256.
AlgorithmHMAC-SHA256
KeyYour account’s signing secret, used as a UTF-8 string, exactly as shown in the app. Do not hex- or base64-decode it.
Signed bytesThe raw request body, exactly as received. Nothing else is signed: no timestamp, URL, method or headers.
EncodingLowercase hexadecimal, 64 characters
PrefixNone. The header contains only the hex digest, without sha256= or a version marker.

Your signing secret is in the Sender app under Settings → Webhooks → Signing secret. One secret signs all of your account’s webhooks. Rotate secret creates a new one.

  1. Read the raw request body before any JSON parsing. Do not parse it and re-serialize it: key order, whitespace and escaping (for example \/ or <) would change, and the signature would no longer match.
  2. Compute HMAC-SHA256 of those bytes with your signing secret as the key, and hex-encode the result.
  3. Compare it with the X-Sender-Hmac-Sha256 header using a constant-time comparison.
  4. If they don’t match, reject the request with a 4xx status other than 404 (see Retries).
import crypto from "node:crypto";
import express from "express";
const app = express();
const secret = process.env.SENDER_WEBHOOK_SECRET;
// express.raw keeps the body as a Buffer with the exact bytes Sender sent.
app.post("/hooks/sender", express.raw({ type: "application/json" }), (req, res) => {
const received = req.get("X-Sender-Hmac-Sha256") ?? "";
const expected = crypto.createHmac("sha256", secret).update(req.body).digest("hex");
const valid =
received.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
if (!valid) {
return res.status(401).send("invalid signature");
}
const payload = JSON.parse(req.body.toString("utf8"));
// ... handle payload
res.sendStatus(200);
});

Use these values to check your implementation. The secret is an example, not a real one.

Secretwhsec_example_not_a_real_secret
Body{"id":"z61Z7gy","email":"[email protected]"}
X-Sender-Hmac-Sha25669c933cce4072bd906886e8b5e1d556fd5392dd7777870751935b68d46f4b31a
Terminal window
printf '%s' '{"id":"z61Z7gy","email":"[email protected]"}' \
| openssl dgst -sha256 -hmac 'whsec_example_not_a_real_secret'

A delivery succeeds when your endpoint answers with a 2xx status within 10 seconds.

  • 404 Not Found: Sender stops right away and does not retry.
  • Any other status, a timeout or a connection error: Sender retries. There are 5 attempts in total, with waits of 5, 10, 20 and 40 seconds between them. After the fifth failed attempt the event is dropped.

Deliveries can arrive out of order, and an event can be delivered more than once, for example when your endpoint processed it but answered too slowly.

Sender does not send a timestamp or an event or delivery ID, in the headers or in the body. A retry sends the same body with the same signature, so a valid signature proves the request came from Sender but not that it is new. To protect against replays and duplicates:

  • Use an HTTPS endpoint, so a request cannot be captured and resent by a third party.
  • Make your handler idempotent. For example, apply a subscriber payload as “set this state” rather than “add one”.
  • To drop exact duplicates, keep the signatures you processed recently (for example for 24 hours), and skip a request whose X-Sender-Hmac-Sha256 you have already seen. Two deliveries with identical bodies have identical signatures.