Skip to main content

Configure Webhook

Once you can receive emails, you can create a route to handle these emails in your application and configure an email.received webhook in your Dashboard. Alternatively, you can use Resend’s code tools to create your webhook from the Webhooks API or with a webhook CLI command. To configure your webhook in the Dashboard:
1

Create a route to receive emails.

In your application, create a new route that can accept POST requests.Here’s how you can implement this:
Once you receive the email event, you can process the email body and attachments. You can also implement webhook request verification to secure your webhook endpoint.
Any email sent to any username at your receiving domain will be received by Resend and forwarded to your webhook. You can intelligently route based on the to field in the webhook event to create different workflows to handle different inbound emails.
2

Go to the Webhooks page in your Resend Dashboard

3

Click Add Webhook.

4

Enter the URL of the route you created for your webhook endpoint.

5

Select the event type `email.received`.

Add Webhook for Receiving Emails
6

Click Add.

For development, you can create a tunnel to your localhost server using a tool like ngrok or VS Code Port Forwarding. These tools serve your local dev environment at a public URL you can use to test your local webhook endpoint.Example: https://example123.ngrok.io/api/webhook
Once you receive an email event, you can process the email body and attachments from the webhook payload.
Webhooks do not include the email body, headers, or attachments, only their metadata. You must call the Received emails API or the Attachments API to retrieve them. This design choice supports large attachments in serverless environments that have limited request body sizes.

API Reference

For complete API documentation, see the Webhooks API reference.