Dropline · Docs

Webhooks

Get a signed POST when mail arrives, a message is sent, a send needs approval, or a domain changes.

Create a webhook

  1. Create it with a token that has webhooks.manage
    curl -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"]}'
  2. Save the secret

    The response includes secret (whsec_…). It is shown once. Rotate it any time with POST /webhooks/{id}/rotate-secret; the old one stops working at once.

  3. Send a test

    POST /webhooks/{id}/test sends a ping event 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

EventWhendata
message.receivedNew mail in INBOX (checked about every minute)mailbox_id, mailbox, folder, uid, message_id, from {name, address}, to [], subject, date, snippet, has_attachments
message.sentA 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.requestedAn API or MCP send is waiting for approvalapproval_id, mailbox_id, token, to [], subject
domain.verifiedA domain’s records check out (sending enabled)domain_id, domain, status, sending, receiving
domain.degradedA previously active domain’s records brokesame as domain.verified
agent.run.completedAn AI agent handled a new messageagent_id, agent, mailbox_id, uid, from, subject, decision (drafted | replied | skipped | escalated), reason
pingPOST /webhooks/{id}/testwebhook_id

Delivery

We POST to your URL with Content-Type: application/json and these headers:

HeaderValue
X-Dropline-EventThe event type, e.g. message.received
X-Dropline-Event-IdThe event’s id. The same across retries and redeliveries: use it to de-duplicate.
X-Dropline-DeliveryThis delivery’s id
X-Dropline-Signaturet=<unix seconds>,v1=<hex HMAC-SHA256>
User-AgentDropline-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 t is 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).

View this page as Markdown