Routes Command

Manage inbound email routes for processing incoming messages through webhooks.

Overview

ahasend routes [subcommand] [flags]
Available subcommands:
  • list - List all inbound email routes
  • create - Create a new inbound email route
  • get - Get detailed information about a specific route
  • update - Update an existing inbound email route
  • delete - Delete an inbound email route
  • listen - Listen for inbound email events in real-time
  • trigger - Trigger route events for testing
Routes enable you to:
  • Process inbound emails through webhooks
  • Filter emails by recipient patterns
  • Control attachment handling and formatting
  • Group messages by conversation threads
  • Strip reply content for cleaner processing

List Routes

ahasend routes list

Create Route

# Basic route
ahasend routes create \
  --match-recipient "[email protected]" \
  --forward-to "https://your-app.com/webhooks/inbound"

# With recipient pattern filtering
ahasend routes create \
  --match-recipient "*@help.example.com" \
  --forward-to "https://api.example.com/email-handler" \
  --description "Help desk routing"

# Advanced route with options
ahasend routes create \
  --match-recipient "support-*@example.com" \
  --forward-to "https://support.example.com/webhook" \
  --strip-replies \
  --group-by-conversation \
  --description "Support ticket routing"

Get Route Details

ahasend routes get route_1234567890abcdef

Update Route

# Update webhook URL
ahasend routes update route_1234567890abcdef \
  --forward-to "https://new-api.example.com/webhook"

# Update recipient pattern
ahasend routes update route_1234567890abcdef \
  --match-recipient "[email protected]"

# Update processing options
ahasend routes update route_1234567890abcdef \
  --strip-replies \
  --group-by-conversation

Delete Route

ahasend routes delete route_1234567890abcdef

Listen for Events (Development)

Listen for inbound email routing events in real-time using WebSocket connection. This command establishes a WebSocket connection to receive inbound email events and can forward them to a local endpoint for development.
# Listen with existing route
ahasend routes listen --route-id abcd1234-5678-90ef-abcd-1234567890ab

# Listen with recipient pattern (backend creates temporary route)
ahasend routes listen --recipient "*@example.com"

# Forward events to local endpoint
ahasend routes listen \
  --recipient "support-*@example.com" \
  --forward-to http://localhost:3000/webhook

# Slim output (minimal event display)
ahasend routes listen --route-id abc123 --slim-output

# Skip SSL verification for local endpoints
ahasend routes listen \
  --route-id abc123 \
  --forward-to https://localhost:3000/webhook \
  --skip-verify

Listen Flags

FlagDescription
--route-idUse existing route instead of creating temporary one
--recipientRecipient pattern for temporary route (e.g., *@domain.com)
--forward-toLocal endpoint to forward events to
--slim-outputSlim down the payload for printing to the console
--skip-verifySkip SSL certificate verification for local endpoints
  • Attachment data is not sent over WebSocket for performance reasons. Only email metadata and content are transmitted.
  • The command generates a webhook secret for signing forwarded events using the standard-webhooks specification.
  • The command handles disconnections with buffered event replay.

Trigger Test Events (Development)

Manually trigger route events for testing:
ahasend routes trigger route_1234567890abcdef
This is a development-only feature and may not be available in production environments.

Next Steps