Webhooks
Get an HTTP callback — or a Slack message — the moment an email is captured.
Creating a webhook
Webhooks live on the organization, under Organization settings → Webhooks. Each one has a type (http or slack), a URL, a signing secret shown once at creation, and an optional sandbox: leave the sandbox empty and the webhook fires for the whole organization, set it and the webhook only fires for that sandbox.
Webhooks come with the Indie plan and the ones above it. On a plan without them the webhooks already configured stay listed and deliver nothing until the organization upgrades.
Webhooks can be disabled without being deleted, which is usually what you want while you are debugging the receiving end.
Events
There is one event today, sent once the captured email has been parsed and indexed:
| Event | Fires when |
|---|---|
email.received | A new email has been captured and is ready to read |
Payload
HTTP webhooks receive a POST with a JSON body. The payload carries a summary, not the full message — fetch the body from the API if you need it.
{ "event": "email.received", "sandbox": { "id": "k3n8x2p9qa7c1m4z", "name": "Acme — staging" }, "email": { "id": "e9v2h6r4ld8w3t5n", "subject": "Reset your password", "from_name": "Acme", "from_email": "noreply@acme.dev", "excerpt": "Click the link below to choose a new password…", "received_at": "2026-08-03T09:14:22+00:00" } }
Verifying the signature
Every HTTP webhook gets a secret when it is created, shown once. Mailclutch uses it to sign each delivery, so your endpoint can tell a real notification from anything else that happens to POST to the URL. The scheme is deliberately small:
- The payload is serialized to JSON once. That exact string is the request body — compact, no pretty-printing.
- Mailclutch computes an HMAC-SHA256 of that string, with your secret as the key.
- The digest, as 64 lowercase hex characters, is sent in the
X-MailClutch-Signatureheader. Nothing else is in it: no prefix, no timestamp, no version.
X-MailClutch-Signature: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b…Your side mirrors it: take the body exactly as received, compute the same HMAC with the same secret, and compare the two digests with a constant-time comparison. Read the raw bytes before any JSON parsing — a body that has been parsed and re-serialized can differ in whitespace or escaping, and a single byte off gives a different digest.
import { createHmac, timingSafeEqual } from 'node:crypto'; // rawBody: the request body as received, before JSON.parse function isSigned(rawBody, signature, secret) { const expected = createHmac('sha256', secret).update(rawBody).digest('hex'); return expected.length === signature.length && timingSafeEqual(Buffer.from(expected), Buffer.from(signature)); }
import hashlib import hmac # raw_body: the request body as received (bytes), before json.loads def is_signed(raw_body: bytes, signature: str, secret: str) -> bool: expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, signature)
// $rawBody: file_get_contents('php://input'), before json_decode function isSigned(string $rawBody, string $signature, string $secret): bool { $expected = hash_hmac('sha256', $rawBody, $secret); return hash_equals($expected, $signature); }
A few things worth knowing. The header is always present on an HTTP delivery, so treat its absence as a failed check rather than an unsigned message. The signature carries no timestamp, so it does not expire on its own: if a replayed delivery would matter to you, remember the email.id values you have already handled — a retry of the same email carries the same id. And Slack webhooks are not signed at all; they go to Slack, not to you.
Retries
A delivery counts as successful on any 2xx. Otherwise Mailclutch retries up to three times, waiting 1 minute, then 5, then 15. Each attempt times out after 15 seconds and is recorded with its status code, duration and error, so you can see the history in the app.
Make your endpoint idempotent — a slow 200 can still be retried if the connection dies — and answer quickly, queueing the real work.
Where we refuse to deliver
Webhook URLs are checked against private and reserved address ranges before every attempt, not only when you save them. A URL that resolves to a private network is refused and the attempt is recorded as failed. This protects other tenants — and you — from Mailclutch being used to reach inside a network it shouldn't.
So a webhook pointing at localhost will not work. During development, use a tunnelling service that gives you a public URL.
Slack
Choose the slack type and paste an incoming-webhook URL from your Slack workspace. Mailclutch posts a formatted message with the sandbox name, the subject, the sender and an excerpt — no configuration on the Slack side beyond creating the incoming webhook. The setup, step by step, and what the message contains are in the Slack section of the integrations guide.