Webhooks
Get a signed POST when mail arrives, a message is sent, a send needs approval, or a domain changes.
Create a webhook
- Create it with a token that has
webhooks.managecurl -X POST https://dropline.cleforyx.com/api/v1/webhooks \ -H "Authorization: Bearer $DROPLINE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com/hooks/dropline","events":["message.received","message.sent"]}' - Save the secret
The response includes
secret(whsec_…). It is shown once. Rotate it any time withPOST /webhooks/{id}/rotate-secret; the old one stops working at once. - Send a test
POST /webhooks/{id}/testsends apingevent to your URL.
Subscribe to ["*"] for every event. Add mailbox_ids to limit mail events to some mailboxes. Webhooks per plan: Free 0, Plus 2, Pro 10, Business 30.
URL rules
https://only, with no credentials in the URL.- No localhost,
.local,.internal, or private, link-local or loopback IPs. This is checked again when we connect, so DNS can’t be used to reach internal hosts. - Redirects are not followed.
Events
| Event | When | data |
|---|---|---|
message.received | New mail in INBOX (checked about every minute) | mailbox_id, mailbox, folder, uid, message_id, from {name, address}, to [], subject, date, snippet, has_attachments |
message.sent | A message left through SMTP, from any path (app, API, MCP, agent) | mailbox_id, mailbox, send_id, message_id, to [addresses], subject, via (web | api | mcp | agent) |
approval.requested | An API or MCP send is waiting for approval | approval_id, mailbox_id, token, to [], subject |
domain.verified | A domain’s records check out (sending enabled) | domain_id, domain, status, sending, receiving |
domain.degraded | A previously active domain’s records broke | same as domain.verified |
agent.run.completed | An AI agent handled a new message | agent_id, agent, mailbox_id, uid, from, subject, decision (drafted | replied | skipped | escalated), reason |
ping | POST /webhooks/{id}/test | webhook_id |
Delivery
We POST to your URL with Content-Type: application/json and these headers:
| Header | Value |
|---|---|
X-Dropline-Event | The event type, e.g. message.received |
X-Dropline-Event-Id | The event’s id. The same across retries and redeliveries: use it to de-duplicate. |
X-Dropline-Delivery | This delivery’s id |
X-Dropline-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256> |
User-Agent | Dropline-Webhooks/1.0 |
Body
{
"id": "6c1d…",
"type": "message.received",
"created_at": "2026-10-30T12:00:00.000Z",
"data": {
"mailbox_id": "…",
"mailbox": "[email protected]",
"folder": "INBOX",
"uid": 4471,
"message_id": "<…@example.com>",
"from": { "name": "Kofi Mensah", "address": "[email protected]" },
"to": ["[email protected]"],
"subject": "Order #4471 delivery",
"date": "2026-10-30T11:59:42.000Z",
"snippet": "Can I change the address to East Legon?",
"has_attachments": false
}
}Verify the signature
Compute HMAC_SHA256(secret, "<t>.<raw body>") as hex and compare it with v1 in constant time. Reject if t is more than 5 minutes old. Use the raw request body, before any JSON parsing.
Node
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(rawBody, header, secret, toleranceSec = 300) {
const m = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(header ?? '');
if (!m) return false;
const [, t, v1] = m;
if (Math.abs(Date.now() / 1000 - Number(t)) > toleranceSec) return false;
const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
return timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}Python
import hmac, hashlib, re, time
def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
m = re.fullmatch(r"t=(\d+),v1=([0-9a-f]{64})", header or "")
if not m: return False
t, v1 = m.groups()
if abs(time.time() - int(t)) > tolerance: return False
expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, v1)Retries and switching off
- Respond with any 2xx within 10 seconds.
- Anything else, or a timeout, is retried 7 more times with growing gaps: after 30 s, then 1, 2, 4, 8, 16 and 32 minutes (about an hour in all). Each attempt is signed fresh, so
tis always current. - Delivery order isn’t guaranteed.
- After 20 deliveries in a row fail every retry, the hook is switched off and you get an email. Turn it back on with
PATCH /webhooks/{id}and{"active": true}; that also resets the failure count.
See the last 50 deliveries with GET /webhooks/{id}/deliveries, and send one again with POST /webhooks/{id}/deliveries/{delivery_id}/redeliver (same event_id).