Events
- inbound.email.received
- outbound.email.delivered
- outbound.email.bounced
- outbound.email.complained
- outbound.email.rejected
- outbound.email.opened
- outbound.email.link_clicked
Good to know • Webhooks are delivered at-least-once. Make your handler idempotent.
1
Create an HTTPS endpoint
Your server just needs to accept POST requests with a JSON body. The example below uses Next.js App Router but any framework works – Flask, FastAPI, Express, Cloudflare Workers, …
2
Configure the webhook in your dashboard
- Go to Webhooks 
- Click Add Webhook → enter the public URL of your endpoint 
- (Optional but recommended) Enable secret signing – we’ll display a random secret once. Copy it immediately and set it as AI_INBX_SECRETin your environment.
 • The secret switch is permanent – you can’t turn it on/off later. Delete & recreate the webhook if you change your mind.
 • Lost or exposed the secret? Use Rotate secret from the webhook’s dropdown to invalidate the old one and get a new value.
3
Verify every request (recommended)
When a secret is enabled we attach two headers:
- X-AiInbx-Timestamp– integer seconds since Unix epoch
- X-AiInbx-Signature–- sha256=followed by an HMAC-SHA256 signature calculated over- timestamp.body
Verify signature (generic Node.js)
4
Manage existing webhooks
Your list of webhooks lives under Webhooks. From here you can:
- Pause deliveries temporarily and resume them later – useful while doing maintenance on your endpoint.
- Rotate the secret with a single click if you suspect it has leaked. We immediately stop using the old secret and display the new one once.
Example: Next.js App Router – SDK helper
The easiest way to handle webhooks in Next.js App Router is thecreateNextRouteHandler helper that ships with the TypeScript SDK. It automatically:
- Verifies the signature when AI_INBX_SECRETis set
- Parses the JSON payload
- Routes the event to the callback you specify
Tip: Your API route can live under any path (e.g., /api/my-inbox-webhook). Just make sure to use that same URL when configuring the webhook in the dashboard.
app/api/aiinbx-webhook/route.ts
Tip: When noAI_INBX_SECRETis configured the helper still works butisVerifiedwill beundefined.
Example: Next.js App Router – manual verification (advanced)
app/api/ai-inbx-webhook/route.ts
Payload structure
| Field | Type | Description | 
|---|---|---|
| event | string | One of the events listed above | 
| data.email | object | The full email record (see GET /emails/{id}in the API reference) | 
| data.organization | object | Organization context – helpful if you operate multiple orgs | 
| attempt | number | Delivery attempt (starts at 1, increments on retries) | 
| timestamp | number | Unix epoch seconds of when we sent the webhook | 
Failure handling & auto-pause
We attempt to deliver each event once. A non-2xx response or a timeout after 30 seconds counts as a failure. AI Inbx tracksconsecutiveFailures for every webhook:
- attemptin the payload equals- consecutiveFailures + 1– useful for debugging.
- After 3 consecutive failures the webhook is automatically paused (isActive = false).
- Paused webhooks stop receiving events until you resume them in the dashboard.
Building an AI agent?
AI Inbx is the drop-in email stack for agents and apps – send, receive and thread messages with a single API.