MailBridge / Docs
Status mailbridge.ai
Documentation API Reference

Docs·Webhooks

Webhooks

Every email MailBridge processes fires a real-time HTTP POST to your endpoint. Build pipelines, sync data, or trigger anything downstream.

Overview

Configure a webhook endpoint in your MailBridge dashboard under Settings → Webhooks. MailBridge will POST a JSON payload to your URL each time a matching event occurs.

Your endpoint must respond with a 2xx status within 10 seconds. Non-2xx responses or timeouts trigger the retry schedule below.

Event types

email.received

Fires when MailBridge receives a raw inbound email before triage.

email.triaged

Fires after AI triage completes. Includes category, priority, summary, and routing destination.

email.replied

Fires when a reply is sent to the customer from inside Slack or Discord.

email.closed

Fires when a request is marked as resolved.

Payload structure

All events share the same envelope. The data object shape varies by event type.

email.triaged — example payload
{
  "event":     "email.triaged",
  "timestamp":  "2025-03-01T09:14:22Z",
  "data": {
    "id":         "req_01JNQX7M4K...",
    "category":   "bug_report",
    "priority":   "high",
    "subject":    "Dashboard not loading",
    "from":       "user@acmecorp.com",
    "summary":    "500 error after login on dashboard",
    "routed_to":  "#bugs"
  }
}

Signature verification

Every request includes a X-MailBridge-Signature header — an HMAC-SHA256 hex digest of the raw request body, signed with your webhook secret. Always verify this before processing.

Node.js — verify signature
import crypto from "node:crypto";

function verifySignature(body, secret, signature) {
  const expected = crypto
    .createHmac("sha256", secret)
    .update(body)
    .digest("hex");
  return crypto.timingSafeEqual(
    Buffer.from(expected),
    Buffer.from(signature)
  );
}

Retry schedule

If your endpoint returns a non-2xx response or times out, MailBridge retries with exponential backoff.

AttemptDelayTotal elapsed
1st retry30 seconds30s
2nd retry5 minutes~5m
3rd retry30 minutes~35m
4th retry2 hours~2.5h
Give up~2.5h