Overview
When receiving webhooks from Inbound, it’s important to verify that requests are legitimate. Inbound includes a verification token in theX-Webhook-Verification-Token header for each webhook request.
Webhook Verification
Every webhook request includes security headers that allow you to verify the request authenticity:| Header | Description |
|---|---|
X-Webhook-Verification-Token | Unique verification token for your endpoint |
X-Endpoint-ID | ID of the endpoint that triggered this webhook |
X-Webhook-Event | Event type (e.g., email.received) |
X-Webhook-Timestamp | ISO 8601 timestamp of when the webhook was sent |
Using the SDK Verification Helper
The SDK provides averifyWebhook helper function that automatically fetches your endpoint configuration and compares the verification token:
- Next.js
- Express.js
- Manual Verification
app/api/webhook/route.ts
How Verification Works
- Verification Token: Each endpoint has a unique verification token stored in its configuration
- Header Transmission: Inbound sends this token in the
X-Webhook-Verification-Tokenheader with every webhook request - SDK Verification: The
verifyWebhookfunction fetches your endpoint config via the API and compares tokens - Security: If tokens don’t match, the request should be rejected
Always verify webhook requests in production to prevent unauthorized access to your endpoints.
The verification token is automatically generated when you create an endpoint. You can view it in your endpoint configuration via the API.
Manual Verification (Without SDK)
If you’re not using the SDK, you can manually verify webhooks by fetching the endpoint configuration:Getting Your Verification Token
You can retrieve the verification token for your endpoint via the API:Best Practices
Always Verify in Production
Never skip webhook verification in production environments. Unverified webhooks can expose your application to security risks.
Handle Verification Failures
Always return appropriate error responses when verification fails:Store API Keys Securely
Never hardcode API keys or commit them to version control:- Use environment variables
- Use secrets management services in production
- Rotate API keys regularly