Skip to main content
Add an endpoint on the Webhooks page. When inbound email arrives, OpenMail POSTs to it.

Add an endpoint

  1. Open Webhooks and click Add endpoint.
  2. Enter your Endpoint URL. It must be publicly reachable.
  3. Leave Auth header or secret empty to use an OpenMail signature. To use Standard Webhooks or a bearer token instead, see Authentication.
  4. Pick the Events to send. All events are selected by default.
  5. Optionally narrow Scope to some pods or inboxes. Empty means the whole organisation.
  6. Click Create endpoint.
  7. On the endpoint page, copy the signing secret under Authentication.
The examples below use the OpenMail signature. For the other schemes, see Verification.

Implementation flow

  1. Receive POST at your endpoint.
  2. Read raw body, X-Timestamp, X-Signature, X-Event-Id.
  3. Verify the signature before processing.
  4. Parse JSON, check event === "message.received".
  5. Use inbox_id to route to the right agent/container.
  6. Return 200 within 15 seconds.

Local development with ngrok

For local development, you need a public URL so OpenMail can reach your machine. ngrok creates a secure tunnel from a public URL to your local server.
  1. Install ngrok: brew install ngrok (macOS) or download from ngrok.com
  2. Sign up and add your authtoken: ngrok config add-authtoken YOUR_AUTHTOKEN
  3. Start your webhook server (see examples below)
  4. In another terminal: ngrok http 3000
  5. Copy the https:// forwarding URL (e.g. https://abc123.ngrok-free.app)
  6. On the Webhooks page, add an endpoint with the URL https://abc123.ngrok-free.app/webhooks
  7. Copy the endpoint’s signing secret into .env as OPENMAIL_WEBHOOK_SECRET
Free ngrok URLs can change when you restart ngrok. When that happens, open the endpoint, click Edit in its actions menu, and update the URL.

Full server examples

Use express.raw() for the webhook route, not express.json(). Signature verification requires the exact raw body.

Testing locally

  1. Start your server and ngrok.
  2. Add an endpoint with your ngrok URL, and set its secret in .env.
  3. Open the endpoint on the Webhooks page and go to the Testing tab.
  4. Pick an event type under Send event and click Send Example. Your server should log the request.
  5. For a real event, send an email to one of your inbox addresses. The delivery shows up in the endpoint’s Message Attempts, with its status and response code.
Example events use placeholder IDs such as inbox_example. They are sent once, are not retried, and don’t appear in the delivery logs.

Production deployment

Deploy your webhook server to a hosting provider with a stable public HTTPS URL. Options include Render, Railway, Fly.io, Vercel (serverless), or any cloud provider.
  • Set OPENMAIL_WEBHOOK_SECRET as an environment variable.
  • Add an endpoint for your production URL, or edit your existing one. Each endpoint has its own secret.
  • Always verify signatures in production - never skip verification.

Best practices

  • Respond quickly - Return 200 within 15 seconds. Process asynchronously if needed.
  • Idempotency - Use event_id to deduplicate. We may retry; your handler should be idempotent.
  • Attachment URLs - Fetch promptly; signed URLs expire.
  • Verify signatures - Never process webhooks without verifying.

Troubleshooting

Events

Payload structure and field descriptions.

Verification

HMAC formula and verification steps.

Overview

Endpoints, delivery semantics, retry policy.

Connect a platform

Send events to Grok, Hermes Agent, or OpenClaw.