Route Testing
Test and debug inbound email routing locally using the AhaSend CLI’s WebSocket-based route listener.Overview
The CLI provides tools for:- Listening to inbound email events in real-time using WebSocket connection
- Using existing routes or creating temporary routes with recipient patterns
- Forwarding events to local endpoints for development
- Displaying events in full or slim output format
- Handling disconnections with buffered event replay
- Triggering test route events
Route Listener
Basic Usage
- 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.
Event Type
message.routing- Triggered when an inbound email matches a route
Event Forwarding
Forward to Local Server
Event Headers
Forwarded requests include standard webhook headers:webhook-id- Unique message identifierwebhook-timestamp- Unix timestampwebhook-signature- HMAC signature for verification
Triggering Test Events
Development Testing
Finding Route IDs
Integration Testing
Development Workflow
Output Formats
Standard Output
Slim Output
Common Flags
Use Cases
Testing Inbound Email Processing
Support Ticket System
Email-to-Task Integration
Best Practices
- Use Temporary Routes for Testing: Create temporary routes with wildcards during development
- Verify Signatures: Always validate webhook signatures in production
- Handle WebSocket Disconnects: Implement reconnection logic for production use
- Test with Trigger Command: Use trigger to test without sending real emails
- Use Slim Output for Monitoring: Reduce console clutter when monitoring events
Troubleshooting
WebSocket Connection Failed: Check network connectivity and firewall settings Events Not Received: Verify the route pattern matches the recipient address Signature Verification Failed: The command automatically generates a webhook secret using the standard-webhooks specification Route Not Found: Check route ID withahasend routes list

