Add an endpoint
- Open Webhooks and click Add endpoint.
- Enter your Endpoint URL. It must be publicly reachable.
- Leave Auth header or secret empty to use an OpenMail signature. To use Standard Webhooks or a bearer token instead, see Authentication.
- Pick the Events to send. All events are selected by default.
- Optionally narrow Scope to some pods or inboxes. Empty means the whole organisation.
- Click Create endpoint.
- On the endpoint page, copy the signing secret under Authentication.
Implementation flow
- Receive POST at your endpoint.
- Read raw body,
X-Timestamp,X-Signature,X-Event-Id. - Verify the signature before processing.
- Parse JSON, check
event === "message.received". - Use
inbox_idto route to the right agent/container. - Return
200within 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.- Install ngrok:
brew install ngrok(macOS) or download from ngrok.com - Sign up and add your authtoken:
ngrok config add-authtoken YOUR_AUTHTOKEN - Start your webhook server (see examples below)
- In another terminal:
ngrok http 3000 - Copy the
https://forwarding URL (e.g.https://abc123.ngrok-free.app) - On the Webhooks page, add an endpoint with the URL
https://abc123.ngrok-free.app/webhooks - Copy the endpoint’s signing secret into
.envasOPENMAIL_WEBHOOK_SECRET
Full server examples
Testing locally
- Start your server and ngrok.
- Add an endpoint with your ngrok URL, and set its secret in
.env. - Open the endpoint on the Webhooks page and go to the Testing tab.
- Pick an event type under Send event and click Send Example. Your server should log the request.
- 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_SECRETas 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
200within 15 seconds. Process asynchronously if needed. - Idempotency - Use
event_idto deduplicate. We may retry; your handler should be idempotent. - Attachment URLs - Fetch promptly; signed URLs expire.
- Verify signatures - Never process webhooks without verifying.
Troubleshooting
Related
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.