New to message routing? Start with our comprehensive routing guide to learn how to create and configure message routes in your dashboard before diving into the API details.
Message routes enable automatic processing of inbound emails sent to your AhaSend domains. When emails arrive at configured addresses, AhaSend parses the content and forwards it to your application endpoints via HTTP POST requests.

Overview

Message routing provides intelligent inbound email handling with:
  • Pattern-based routing using exact addresses or wildcards (*, ticket-*, *-support)
  • Real-time delivery via HTTP POST to your configured endpoints
  • Flexible processing options for attachments, headers, and reply extraction
  • Secure payload delivery following the Standard Webhooks specification

Prerequisites

Message routing requires:
  • Domain added and verified in AhaSend
  • MX records pointing to AhaSend mail servers
  • Endpoint accepting HTTP POST requests with 2xx responses

Payload Structure

All routing events use a consistent JSON structure:
{
  "type": "message.routing",
  "timestamp": "2024-05-07T10:41:45.026792973Z",
  "data": {
    "from": "[email protected]",
    "to": "[email protected]",
    "subject": "Email subject",
    "html_body": "<p>Email content</p>",
    "plain_body": "Email content",
    // Additional fields based on configuration
  }
}

Security Headers

Every routing request includes security headers for verification:
  • webhook-id: Unique event identifier for idempotency
  • webhook-timestamp: Unix timestamp when the route was triggered
  • webhook-signature: HMAC signature for payload verification

Getting Started