Skip to content
Hermesmail
Docs pages

Webhooks

Hermesmail delivers signed HTTPS POST requests to your webhook endpoints whenever subscribed email, domain or suppression events happen in your team. Each endpoint carries its own signing secret so your receiver authenticates every delivery before trusting the payload.

Endpoints

Each webhook endpoint defines an HTTPS destination URL and an event subscription:

  • Destination URL: a public HTTPS endpoint reachable from the internet. Private, loopback, link-local, reserved IP ranges and hermesmail.app hostnames are refused at configuration and delivery time.
  • Subscribed events: either a list of registered event names in events, or null to receive every event type.
  • Signing secret: generated automatically with a whsec_ prefix and shown when the endpoint is created, retrieved or rotated. Store it in an environment variable or secret manager rather than source code.
  • Secret rotation: rotating an endpoint's secret issues a new whsec_ value while continuing to sign deliveries with both the new secret and the previous secret for 24 hours so receivers roll over without dropping traffic.
  • Disabling and deleting: disabling an endpoint marks its pending retries failed and stops further deliveries until it is re-enabled; deleting an endpoint cancels pending work immediately.
  • Per-plan endpoint quota: the number of non-deleted endpoints (enabled and disabled together) a team holds at once is set by the team's webhook_endpoints entitlement (see Limits).

Event types

Endpoints accept any registered event name in events. Types marked Emitted are delivered today; types marked Planned are accepted in subscriptions and begin delivering when their feature opens.

Event Group Status Description
email.sent Email Emitted We handed the message to the provider for delivery.
email.delivered Email Emitted The recipient’s mail server took the message.
email.delivery_delayed Email Emitted Delivery hit a temporary problem, and the provider is still trying.
email.bounced Email Emitted The recipient’s server refused the message; data.bounce says why.
email.complained Email Emitted The recipient reported a delivered message as spam.
email.failed Email Emitted We could not send the message; data.failed gives the reason.
email.suppressed Email Emitted We did not send to this address because it is on the suppression list.
email.scheduled Email Emitted The message was accepted to go out at a later time.
email.opened Email Planned The recipient opened a message with open tracking on.
email.clicked Email Planned The recipient followed a tracked link; data.click holds the details.
email.received Email Planned A message arrived at one of the team’s receiving addresses.
domain.created Domain Emitted A sending domain was added to the team.
domain.updated Domain Emitted A domain’s status, one of its records or one of its settings changed.
domain.deleted Domain Emitted A domain was removed; data holds how it last stood.
contact.created Contact Planned A contact was added.
contact.updated Contact Planned A contact’s details changed.
contact.deleted Contact Planned A contact was removed.
contact.topics.updated Contact Planned Someone opted a contact into a topic or out of one.
suppression.added Suppression Emitted An address joined the team’s suppression list.
suppression.removed Suppression Emitted An address left the team’s suppression list.
topic.created Topic Planned A topic was added.
topic.updated Topic Planned A topic’s details changed.
topic.deleted Topic Planned A topic was removed.
inbox.created Inbox Planned A hosted inbox was set up.
inbox.updated Inbox Planned A hosted inbox’s settings changed.
inbox.deleted Inbox Planned A hosted inbox was removed.
inbox.thread.created Inbox Planned A new conversation started in an inbox.
inbox.thread.folder.updated Inbox Planned A conversation moved to another folder.
inbox.thread.assigned Inbox Planned A conversation was given to a teammate.
inbox.thread.unassigned Inbox Planned A conversation no longer has anyone assigned.
inbox.thread.labels.updated Inbox Planned Labels were added to or taken off a conversation.
inbox.email.received Inbox Planned A message came in to an inbox.
inbox.email.sent Inbox Planned A message went out from an inbox.
inbox.draft.created Inbox Planned A draft was started.
inbox.draft.updated Inbox Planned A draft was edited.
inbox.draft.sent Inbox Planned A draft went out as a message.
inbox.draft.deleted Inbox Planned A draft was thrown away.

Payload envelope and headers

Every delivery sends a JSON body containing exactly three top-level keys: type, created_at (ISO 8601 UTC with milliseconds recording when the event happened) and data (the event-specific object). The body carries no separate top-level event id; the stable identifier for deduplication is the svix-id header.

{
  "type": "email.delivered",
  "created_at": "2026-11-26T12:00:00.000Z",
  "data": {
    "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
    "created_at": "2026-11-26T11:59:58.120Z",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "subject": "Order receipt"
  }
}

Every HTTP delivery request includes these headers:

  • content-type: application/json.
  • user-agent: Hermesmail-Webhooks/1.0 on every attempt.
  • svix-id: the message identifier (msg_ followed by a KSUID), identical across the initial attempt, automatic retries and manual replays of the same message.
  • svix-timestamp: the Unix epoch time of this delivery attempt in whole seconds, refreshed on every retry and replay.
  • svix-signature: one or more space-separated v1,<base64> signatures computed with HMAC-SHA256. Normal deliveries include a single entry; deliveries during a 24 hours rotation overlap include two entries, with the current secret first.

Each payload is capped at 256 KiB on the wire; if an envelope would exceed that cap, data.headers is omitted first.

Verify signatures

Authenticate every incoming webhook request before acting on its payload. Hermesmail signs deliveries with the Standard Webhooks / Svix scheme:

  1. Remove the whsec_ prefix from your endpoint's signing secret and base64-decode the remainder to obtain the raw HMAC key bytes.
  2. Construct the signed string as <svix-id>.<svix-timestamp>. concatenated with the exact raw body bytes received over HTTP.
  3. Compute HMAC-SHA256 over those bytes using the decoded key and encode the digest as standard padded base64 (v1,<digest>).
  4. Compare the computed digest against each v1, entry in svix-signature using a constant-time comparison.

Always verify the raw request body before parsing JSON. Parsing the body with JSON middleware and re-serialising it changes whitespace, key order or Unicode escaping, which breaks signature verification. Read the raw request bytes (Buffer, Uint8Array or untouched request text), verify the signature against those exact bytes, and call JSON.parse only after verification succeeds.

Reject any request whose svix-timestamp differs from your server clock by more than 5 minutes (300 seconds) in either direction to stop replay attacks. Because svix-timestamp records the time of the delivery attempt rather than the original event time, delayed retries still fall inside that window. Store processed svix-id values and ignore duplicates.

Verify with the svix library

Install the svix package and pass the raw request body bytes together with the svix-id, svix-timestamp and svix-signature headers to new Webhook(secret).verify(rawBody, headers). Read the whsec_ secret from HERMESMAIL_WEBHOOK_SECRET in your environment.

import { readFileSync } from 'node:fs';
import { Webhook } from 'svix';

const secret = process.env.HERMESMAIL_WEBHOOK_SECRET;
if (!secret) throw new Error('HERMESMAIL_WEBHOOK_SECRET is required');

// Read the exact raw request body bytes before parsing JSON.
const rawBody = readFileSync(0);
const headers = {
  'svix-id': process.env.SVIX_ID ?? '',
  'svix-timestamp': process.env.SVIX_TIMESTAMP ?? '',
  'svix-signature': process.env.SVIX_SIGNATURE ?? '',
};

const webhook = new Webhook(secret);
webhook.verify(rawBody, headers);

// Parse the JSON envelope only after the signature checks out.
const event = JSON.parse(rawBody.toString('utf8'));
console.log(JSON.stringify({ type: event.type, created_at: event.created_at }));

Verify manually without a library

When running without the svix package, verify the signature directly with node:crypto (or the equivalent HMAC-SHA256 and constant-time comparison primitives in your language). Check the timestamp against the 5 minutes (300 seconds) window, iterate through every space-separated v1, signature so rotation overlap succeeds seamlessly, and compare raw digest bytes with timingSafeEqual.

import { createHmac, timingSafeEqual } from 'node:crypto';
import { readFileSync } from 'node:fs';

const SECRET_PREFIX = 'whsec_';
const TOLERANCE_SECONDS = 300;

const secret = process.env.HERMESMAIL_WEBHOOK_SECRET ?? '';
if (!secret.startsWith(SECRET_PREFIX)) {
  throw new Error('HERMESMAIL_WEBHOOK_SECRET must start with whsec_');
}

const keyPart = secret.slice(SECRET_PREFIX.length);
const key = Buffer.from(keyPart, 'base64');
if (key.length === 0 || key.toString('base64') !== keyPart) {
  throw new Error('HERMESMAIL_WEBHOOK_SECRET is not valid base64');
}

const id = process.env.SVIX_ID ?? '';
const timestampHeader = process.env.SVIX_TIMESTAMP ?? '';
const signatureHeader = process.env.SVIX_SIGNATURE ?? '';
if (!id || !timestampHeader || !signatureHeader) {
  throw new Error('Missing required svix-id, svix-timestamp or svix-signature header');
}

if (!/^(?:0|[1-9]\d*)$/.test(timestampHeader)) {
  throw new Error('svix-timestamp must be whole Unix seconds');
}
const timestamp = Number(timestampHeader);
const now = Math.floor(Date.now() / 1000);
if (!Number.isSafeInteger(timestamp) || Math.abs(now - timestamp) > TOLERANCE_SECONDS) {
  throw new Error('svix-timestamp is outside the allowed tolerance window');
}

// Verify against the exact raw request body bytes before parsing JSON.
const rawBody = readFileSync(0);
const expected = createHmac('sha256', key)
  .update(`${id}.${timestampHeader}.`)
  .update(rawBody)
  .digest();

const matched = signatureHeader
  .trim()
  .split(/\s+/)
  .some((entry) => {
    const comma = entry.indexOf(',');
    if (comma <= 0) return false;
    const version = entry.slice(0, comma);
    const encoded = entry.slice(comma + 1);
    if (version !== 'v1' || !encoded) return false;
    const candidate = Buffer.from(encoded, 'base64');
    if (candidate.toString('base64') !== encoded || candidate.length !== expected.length) {
      return false;
    }
    return timingSafeEqual(candidate, expected);
  });

if (!matched) {
  throw new Error('Webhook signature did not match');
}

const event = JSON.parse(rawBody.toString('utf8'));
console.log(JSON.stringify({ type: event.type, created_at: event.created_at }));

Delivery semantics and retries

Hermesmail delivers every event at least once while the endpoint remains enabled, and does not guarantee delivery order across events for the same email. A delivery whose response drops after your receiver finishes processing is retried with the same svix-id, and an earlier event undergoing retries may arrive after a newer one. Sort state transitions by created_at and deduplicate on svix-id.

An attempt succeeds when the endpoint returns any 2xx HTTP status within 15 seconds (covering connection setup, TLS negotiation, response headers and reading the capped response body). Redirects (3xx) are never followed and count as failures. Up to 4 KiB of each response body is saved in the delivery log without affecting success or failure.

A failing message receives up to 8 total attempts — an immediate first delivery followed by 7 retries spanning 27 hours 35 minutes 5 seconds before jitter. Each retry wait adds up to 10% random jitter so concurrent failures spread out over time:

Attempt Wait after previous failure
1 Immediate
2 5 seconds
3 5 minutes
4 30 minutes
5 2 hours
6 5 hours
7 10 hours
8 10 hours

An endpoint that records no successful delivery for 5 days with at least 20 messages reaching failed in that span is disabled automatically, and every team admin receives an email naming the endpoint URL and failure duration. Re-enabling the endpoint resets the failure streak.

Rule Value
User-Agent header Hermesmail-Webhooks/1.0
Attempt timeout 15 seconds
Total attempts 8 (first attempt plus 7 retries)
Retry window (before jitter) 27 hours 35 minutes 5 seconds
Retry jitter Up to +10%
Recommended timestamp tolerance 5 minutes (300 seconds)
Secret rotation overlap 24 hours
Maximum payload size 256 KiB
Stored response body cap 4 KiB
Concurrent attempts per endpoint 2
Concurrent attempts per team 2
Auto-disable threshold No success for 5 days with at least 20 failed messages

Replaying deliveries

Replaying a delivery queues one additional attempt for a recorded message in any state (success or failed) through POST /webhooks/{webhook_id}/events/{event_id}/replay or from the delivery detail view in the dashboard.

A replay posts the original svix-id and stored payload bytes with a fresh svix-timestamp and fresh svix-signature. If the replay succeeds, the message moves to success and any remaining automatic retry is cleared; if it fails, any pending automatic retry keeps its original scheduled time. Replaying on a disabled endpoint returns HTTP 422 with error name validation_error.

Source IP addresses

Hermesmail webhook deliveries do not originate from a fixed list of IP addresses. Outbound webhook traffic leaves from dynamic addresses, so IP allowlists break deliveries and offer no reliable trust boundary.

Authenticate every incoming webhook strictly by verifying the svix-id, svix-timestamp and svix-signature headers against your endpoint's whsec_ signing secret rather than filtering by source IP address. If outbound webhook traffic moves behind fixed egress addresses in the future, Hermesmail will publish those addresses here with advance notice before any change takes effect.