Overview
Webhooks are how Inbound notifies your application when emails arrive. When an email is received at one of your configured addresses, Inbound sends an HTTP POST request to your webhook endpoint with the complete email data, parsed and ready to use.Webhooks in Inbound:
- Are sent via HTTP POST with JSON payload
- Include complete email data (headers, body, attachments)
- Support signature verification for security
- Automatically retry on failure (up to 3 times)
- Include parsed and cleaned email content
Webhook Payload Structure
From the TypeScript types (lib/types/inbound-webhooks.ts:69-90):
Email Address Types
From the types (lib/types/inbound-webhooks.ts:1-9):
Webhook Headers
Every webhook request includes these security headers:| Header | Description | Example |
|---|---|---|
X-Webhook-Verification-Token | Secret token for verification | tok_abc123def456... |
X-Endpoint-ID | ID of the endpoint | endp_xyz789 |
X-Webhook-Event | Event type | email.received |
X-Webhook-Timestamp | ISO 8601 timestamp | 2024-01-15T10:30:00Z |
X-Email-ID | Inbound email ID | inbnd_abc123def456 |
X-Message-ID | Original email message ID | <[email protected]> |
Content-Type | Always JSON | application/json |
User-Agent | Inbound identifier | InboundEmail-Webhook/1.0 |
Webhook Security
Verification Token Method
The simplest way to verify webhooks is using the verification token:Manual Token Verification
If you prefer to verify manually:Handling Webhooks
Basic Webhook Handler
Handling Attachments
From the example (docs/api-reference/webhook.mdx:217-245):
Attachment download URLs:
- Format:
https://inbound.new/api/e2/attachments/{emailId}/{filename} - Require API key authentication
- Are valid for the lifetime of the email
- Return the original file with correct Content-Type
Handling Threads
Inbound automatically tracks conversation threads:Auto-Reply Example
From the README (README.md:37-76):
Webhook Retry Logic
Inbound automatically retries failed webhook deliveries:
- Retry attempts: Up to 3 times (configurable)
- Retry delay: Exponential backoff (1s, 2s, 4s)
- Success criteria: HTTP 200-299 status code
- Failure criteria: Non-2xx status, timeout, or network error
Webhook Best Practices
Async Processing Pattern
Error Handling
FAQ
FAQ
Testing Webhooks
Use the endpoint test feature to verify your webhook:- Webhook URL is accessible
- Verification token is correct
- Your handler processes the payload correctly
- Response time is acceptable
Next Steps
- Create endpoints to configure webhook delivery
- Set up email addresses to route emails to webhooks
- View the webhook API reference for complete payload documentation