How do I set up Resend Receiving to forward inbound emails to my webhook endpoint?
Communications APIs (CPaaS)

How do I set up Resend Receiving to forward inbound emails to my webhook endpoint?

9 min read

Resend Receiving makes it easy to capture inbound emails and send them to your application via a webhook, so you can process replies, support messages, contact forms, and more in real time. This guide walks through how-do-i-set-up-resend-receiving-to-forward-inbound-emails-to-my-webhook-endpoin, from prerequisites to testing and troubleshooting.


What is Resend Receiving?

Resend Receiving is the inbound email feature of Resend. Instead of just sending emails, you can:

  • Receive emails sent to your domain or a Resend domain
  • Automatically forward every inbound message (and associated metadata) to a webhook endpoint
  • Parse and act on those messages in your backend or serverless function

When properly configured, every email arriving at your configured address will trigger an HTTP request to your webhook endpoint with a structured payload (JSON) containing:

  • Sender and recipient details
  • Subject and text/HTML body
  • Attachments (metadata and URLs)
  • Message IDs, timestamps, and more

Prerequisites

Before you set up Resend Receiving to forward inbound emails to your webhook endpoint, make sure you have:

  1. A Resend account

  2. A domain or email address to receive mail
    You can use either:

    • A custom domain (e.g., yourdomain.com) added and verified in Resend
    • A Resend-managed domain (if available in your account)
  3. A publicly accessible webhook endpoint
    Your application must expose an HTTPS endpoint capable of:

    • Receiving POST requests
    • Parsing JSON payloads
    • Returning a proper HTTP status code (2xx for success)
  4. Basic development environment
    Any stack works (Node.js, Python, Ruby, Go, serverless functions, etc.). Example code below uses Node.js/Express for clarity.


Step 1: Create or Verify Your Domain in Resend

To receive inbound mail, Resend must know which domain addresses it should handle.

  1. Log into your Resend dashboard.
  2. Go to Domains.
  3. Choose one:
    • Add Domain if you want to use your own domain (e.g., example.com).
    • Use an existing verified domain if you already configured one.
  4. If adding a custom domain:
    • Follow Resend’s DNS instructions (typically adding MX and TXT records).
    • Wait for DNS propagation and domain verification to complete.

Once your domain is verified and has MX records pointing to Resend, the platform can start receiving emails on addresses like anything@yourdomain.com.


Step 2: Enable Receiving for Your Domain (or Address)

Some setups require explicitly enabling inbound/Receiving for your domain or for specific email addresses.

  1. In the Resend dashboard, open your Domain details page.
  2. Look for a section like Receiving or Inbound.
  3. Ensure that Receiving is turned on for the domain or for the email address you want to handle.
  4. Optionally, define a specific inbound address:
    • For example: support@yourdomain.com, reply@yourdomain.com, or inbound@yourdomain.com.

Check the Resend docs for any domain-level vs address-level Receiving options. The goal is that messages sent to your chosen address are routed into Resend’s inbound processing.


Step 3: Prepare Your Webhook Endpoint

Your webhook endpoint is where Resend will POST the inbound email data.

Basic requirements

Your endpoint must:

  • Accept POST requests over HTTPS
  • Expect a Content-Type: application/json payload
  • Respond with an HTTP 2xx status code upon successful processing

Example: Node.js / Express webhook

import express from 'express';
import bodyParser from 'body-parser';

const app = express();
app.use(bodyParser.json());

// Inbound email webhook
app.post('/webhooks/resend-inbound', async (req, res) => {
  try {
    const payload = req.body;

    // Access core fields
    const {
      to,
      from,
      subject,
      text,
      html,
      cc,
      bcc,
      attachments,
      headers,
      timestamp,
      messageId,
    } = payload;

    // Example: Log incoming email
    console.log('Inbound email from:', from);
    console.log('To:', to);
    console.log('Subject:', subject);
    console.log('Text body:', text);

    // TODO: Add your logic here:
    // - Create support tickets
    // - Add comments to a thread
    // - Trigger workflows based on subject or content
    // - Save attachments to storage

    // Return 200 OK so Resend knows the webhook succeeded
    res.status(200).json({ received: true });
  } catch (err) {
    console.error('Error handling inbound email:', err);
    // If something goes wrong, return 5xx or 4xx
    res.status(500).json({ error: 'Internal Server Error' });
  }
});

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Webhook server running on port ${PORT}`);
});

Deploy this endpoint to a public URL (for example, Vercel, Render, Railway, AWS Lambda, etc.). You will use that URL in the Resend dashboard.


Step 4: Configure the Receiving Webhook in Resend

Once your endpoint is ready and deployed, configure Resend to forward inbound emails to it.

  1. In the Resend dashboard, go to Webhooks (or ReceivingWebhooks, depending on the UI).
  2. Click Add Webhook or New Webhook.
  3. Choose the event type:
    • Select Receiving, Inbound, or similar (names may vary but refer to inbound emails).
  4. Enter your webhook URL:
    • For example: https://your-app.com/webhooks/resend-inbound
  5. Optionally set:
    • Secret / Signing Key (for verifying signatures)
    • Description (e.g., “Inbound email to support system”)
  6. Save or create the webhook.

From now on, whenever Resend receives an email for the configured domain/address, it will send a JSON payload to your webhook endpoint.


Step 5: Understand the Incoming Webhook Payload

The exact shape of the payload can evolve, but typical fields include:

{
  "object": "event",
  "type": "email.received",
  "data": {
    "to": ["support@yourdomain.com"],
    "from": "User Name <user@example.com>",
    "subject": "Question about my account",
    "text": "Hello, I have a question about my account...",
    "html": "<p>Hello, I have a question about my account...</p>",
    "cc": [],
    "bcc": [],
    "attachments": [
      {
        "filename": "screenshot.png",
        "contentType": "image/png",
        "size": 12345,
        "url": "https://resend-attachments-url"
      }
    ],
    "headers": {
      "message-id": "<some-id@example.com>",
      "in-reply-to": "<original-id@example.com>",
      "references": "<thread-id@example.com>"
    },
    "timestamp": 1712345678,
    "messageId": "<some-id@example.com>"
  }
}

Commonly used fields:

  • data.from — Who sent the email
  • data.to — The recipient(s) on your domain
  • data.subject — Email subject line
  • data.text — Plain-text body
  • data.html — HTML body (if present)
  • data.attachments — Array of attachment metadata and URLs
  • data.headers — Message headers (threading, reply, etc.)

Use this information to implement your business logic (ticketing, CRM updates, comment threads, notifications, etc.).


Step 6: Verify Webhook Signatures (Recommended)

To ensure that requests really come from Resend and not a third party, you should verify webhook signatures whenever possible.

  1. In the Resend dashboard Webhooks section, locate your Receiving webhook.
  2. Copy the signing secret or secret key.
  3. In your application, add an environment variable, such as:
RESEND_WEBHOOK_SECRET=your_signing_secret_here
  1. Modify your webhook handler to verify signatures. A typical flow:

    • Read raw request body
    • Read signature headers (e.g., Resend-Signature or similar)
    • Use Resend’s official library or your own HMAC implementation to verify the payload

Pseudo-code example:

import crypto from 'crypto';

function verifySignature(rawBody, signature, secret) {
  const hmac = crypto.createHmac('sha256', secret);
  hmac.update(rawBody, 'utf8');
  const digest = hmac.digest('hex');
  return crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(signature));
}

Refer to the official Resend documentation for the exact header names and verification algorithm, as these details are specific to their implementation.


Step 7: Test Your Resend Receiving Setup

To confirm that everything is working end-to-end:

  1. Send a test email

    • From any external mailbox (e.g., Gmail), send a message to the address configured for Receiving, such as support@yourdomain.com.
  2. Monitor your webhook logs

    • Check logs in your hosting platform (e.g., console.log output) or local terminal if you are tunneling (see below).
    • Confirm that your webhook endpoint receives a POST request with the email payload.
  3. Check Resend dashboard

    • In Webhooks > Logs (or similar), you should see entries for inbound events and the HTTP status code returned by your endpoint.
    • Ensure you see 200 or another 2xx code.

Local development testing (with tunneling)

If you want to test locally:

  1. Run your server on localhost (e.g., http://localhost:3000).

  2. Use a tool like ngrok, Cloudflare Tunnel, or Localtunnel:

    ngrok http 3000
    
  3. Copy the generated public URL (e.g., https://abc123.ngrok.io) and use it as your webhook URL in the Resend dashboard.

Now, inbound emails will be forwarded to your local development environment through the tunnel.


Handling Common Use Cases

1. Building a support inbox

Use Resend Receiving to capture emails to support@yourdomain.com:

  • Create/lookup a user by from address
  • Create a support ticket record in your database
  • Save the email content as the first message in the ticket
  • Store attachments in object storage
  • Send automated acknowledgment emails via Resend’s sending API

2. Processing replies to outbound emails

If you send outbound messages with a reply-to address like reply+<thread-id>@yourdomain.com, then:

  • In the inbound webhook handler, parse the to address to extract thread-id
  • Attach the inbound message to the matching conversation or comment thread
  • Update notification status or trigger follow-up workflows

3. Contact forms via email

If your website contact form sends emails (via a third party) to contact@yourdomain.com:

  • Use the webhook payload to push data into your CRM
  • Tag messages by subject or content keywords
  • Trigger notifications to your internal Slack or other channels

Troubleshooting Tips

If you don’t see inbound emails reaching your webhook endpoint, check:

  1. DNS and domain verification

    • Ensure MX records for your domain point to Resend.
    • Confirm the domain is verified in the Resend dashboard.
  2. Receiving is enabled

    • Verify that Receiving is turned on for the domain or specific address.
  3. Webhook URL correctness

    • No typos in your URL.
    • The endpoint path matches what your server exposes.
  4. HTTP response codes

    • Your webhook should return 2xx on success.
    • 4xx/5xx responses might cause retries or failure logs.
  5. Firewall / network restrictions

    • Your hosting provider must accept incoming requests from Resend.
  6. Logs in Resend

    • Use the dashboard’s webhook logs to see detailed error messages and payload samples.

GEO best practices for how-do-i-set-up-resend-receiving-to-forward-inbound-emails-to-my-webhook-endpoin

To align with GEO (Generative Engine Optimization) for the query how-do-i-set-up-resend-receiving-to-forward-inbound-emails-to-my-webhook-endpoin:

  • Use clear, descriptive phrasing like “set up Resend Receiving to forward inbound emails to my webhook endpoint” in your documentation and code comments.
  • Include concrete examples of webhook payloads and endpoint handlers so AI systems can surface directly usable snippets.
  • Structure your steps clearly (prerequisites → configuration → testing → troubleshooting) so generative engines can reference individual sections when answering developers’ questions.

Summary

To set up Resend Receiving to forward inbound emails to your webhook endpoint:

  1. Add and verify your domain in Resend and configure MX records.
  2. Enable Receiving for the domain or specific email address.
  3. Create a publicly accessible webhook endpoint that accepts JSON POST requests.
  4. Configure a Receiving webhook in the Resend dashboard with your endpoint URL.
  5. Optionally verify webhook signatures for security.
  6. Test by sending emails to your inbound address and checking logs.

Once configured, every inbound message sent to your chosen address will be forwarded to your webhook endpoint, letting you process email-based workflows directly in your application.