Skip to Content
MailroomMailroom home

Webhooks and events

Standard Webhooks signatures, event types, agent scoping, retries and replay.

Mailroom POSTs a JSON event to your URL when something happens. Payload: { id, type, created_at, data }. Requests are signed with Standard Webhooks headers (webhook-id, webhook-timestamp, webhook-signature), so any Standard Webhooks library verifies them with your whsec_… secret.

import { Webhook } from "standardwebhooks";

const event = new Webhook(process.env.MAILROOM_WEBHOOK_SECRET!).verify(rawBody, headers);

Create one

  • For one agent: the agent's page → Notify your agent. It only receives events about that agent.
  • For the workspace: POST /v1/webhooks with { "url": "https://…", "event_types": ["email.bounced"] }. Add "agent_id": "agt_…" to scope it to an agent. Leave event_types out to get everything.

The secret is returned once. Rotate it with POST /v1/webhooks/{id}/rotate-secret; send a test event with POST /v1/webhooks/{id}/test.

Event types

GroupEvents
Inboxinbound.received
Conversationsthread.escalated, thread.resolved, thread.handed_back (data adds guidance)
Approvalsapproval.requested, approval.approved, approval.rejected, approval.expired
Emailemail.sent, email.delivered, email.delivery_delayed, email.bounced, email.complained, email.failed, email.suppressed
Workspacedomain.verified, domain.failed, agent.paused

inbound.received data: message_id, thread_id, inbox_id, agent_id, from, subject, auto_reply, agent_verified, attachments (id, filename, content_type, size_bytes), attachments_omitted, content_is_untrusted. Thread events carry thread_id, inbox_id, agent_id, status, reason.

Delivery

  • At least once: deduplicate on webhook-id.
  • Answer with a 2xx within 10 seconds and do slow work afterwards. Failures retry with backoff.
  • History: GET /v1/webhooks/{id}/deliveries. Resend one: POST /v1/webhooks/deliveries/{id}/replay.
  • URLs must be public; private and cloud-metadata addresses are refused.

On this page