> ## Documentation Index
> Fetch the complete documentation index at: https://docs.naturalead.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Email Inbound

> Receives inbound email events from Resend. Only `email.received` events
are processed. The conversation is identified by extracting a conversation
ID from the `to` address pattern: `reply+{conversationId}@{domain}`.
The full email content is fetched from the Resend API.




## OpenAPI

````yaml POST /api/webhooks/email
openapi: 3.1.0
info:
  title: Naturalead Inbound Webhooks API
  version: 1.0.0
  description: >
    Inbound webhook endpoints for receiving messages and leads from external

    services. These endpoints do not use standard API key authentication.

    Each channel uses its own verification mechanism (token-based,
    signature-based,

    or challenge-response).
servers:
  - url: '{baseUrl}'
    description: API server
    variables:
      baseUrl:
        default: http://localhost:3001
security: []
tags:
  - name: Lead Webhooks
    description: Inbound lead creation via webhook token
  - name: Telegram Webhooks
    description: Inbound Telegram messages
  - name: Email Webhooks
    description: Inbound email messages via Resend
  - name: WhatsApp Webhooks
    description: Inbound WhatsApp messages via Meta Cloud API
paths:
  /api/webhooks/email:
    post:
      tags:
        - Email Webhooks
      summary: Email inbound webhook
      description: >
        Receives inbound email events from Resend. Only `email.received` events

        are processed. The conversation is identified by extracting a
        conversation

        ID from the `to` address pattern: `reply+{conversationId}@{domain}`.

        The full email content is fetched from the Resend API.
      operationId: emailInbound
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Resend webhook event
              properties:
                type:
                  type: string
                  description: Event type (only "email.received" is processed)
                  example: email.received
                data:
                  type: object
                  properties:
                    email_id:
                      type: string
                    from:
                      type: string
                    to:
                      type: array
                      items:
                        type: string
                    subject:
                      type: string
                    message_id:
                      type: string
              required:
                - type
                - data
      responses:
        '200':
          description: Event received
          content:
            application/json:
              schema:
                type: object
                properties:
                  received:
                    type: boolean
                    example: true
        '400':
          description: Missing required fields
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Failed to fetch email content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
      required:
        - error

````