POST request with the message details to your configured webhook URL.
Prerequisites
- A Telnyx phone number assigned to a messaging profile
- A webhook URL configured on your messaging profile
- ngrok or similar tool for local development
Already have a webhook server? Skip to Configure your webhook URL to point it at your messaging profile.
Quick Start
Expose your local server
Use ngrok to create a public URL that forwards to your local server:Copy the forwarding URL (e.g.,
https://abc123.ngrok.io).Configure your webhook URL
Set the webhook URL on your messaging profile via the Portal or API:
Auto-Reply to Incoming Messages
A common pattern is sending an automatic reply when a message arrives. Combine your webhook handler with the Send Message API:Webhook Payload Reference
Inbound SMS
Inbound MMS
MMS messages include amedia array with downloadable attachments:
MMS media URLs expire after 30 days. Download and store media files if you need long-term access.
Webhook Payload Schema
- Top-level fields
- Payload fields
- Media fields (MMS)
| Field | Type | Description |
|---|---|---|
data.event_type | string | Always message.received for inbound messages |
data.id | string | Unique event ID (UUID) — use for idempotency |
data.occurred_at | string | ISO 8601 timestamp when the event occurred |
data.record_type | string | Always event |
meta.attempt | integer | Webhook delivery attempt number (1–3) |
meta.delivered_to | string | The webhook URL this was delivered to |
Downloading MMS Media
Download media attachments from inbound MMS messages using the URLs in themedia array. Authenticate with your API key:
Verifying Webhook Signatures
In production, verify webhook signatures to confirm requests are from Telnyx. All webhooks are signed using ED25519 public key cryptography. Each webhook includes two headers:telnyx-signature-ed25519— Base64-encoded signaturetelnyx-timestamp— Unix timestamp when the webhook was sent
Handling Failed Webhooks
When webhook delivery fails, Telnyx retries automatically. Build resilience into your architecture:Troubleshooting
Webhooks not arriving
Webhooks not arriving
Check your webhook URL is configured:Common causes:
- Webhook URL not set on the messaging profile
- Phone number not assigned to the messaging profile
- Server not publicly accessible (use ngrok for local dev)
- Firewall blocking Telnyx IPs
Receiving duplicate webhooks
Receiving duplicate webhooks
Duplicates happen when your server doesn’t respond with
2xx within the timeout (2 seconds for API v2). Telnyx retries up to 2 times.Fix: Return 200 immediately, then process the message asynchronously. Use the payload.id field to deduplicate.Webhook timeout errors
Webhook timeout errors
Your server must respond within 2 seconds (API v2) or 5 seconds (API v1).Solutions:
- Return
200immediately, process in background - Use a message queue (Redis, SQS, RabbitMQ) for heavy processing
- Set up a failover URL as a backup
Missing media in MMS
Missing media in MMS
- Check the
typefield isMMS(SMS messages have an emptymediaarray) - Media URLs require authentication — include your API key in the
Authorizationheader - Media URLs expire after 30 days
- Verify your number is MMS-enabled in the Portal
Webhook URL Hierarchy
Telnyx checks for webhook URLs in this order:- Request body — URLs provided when sending a message (outbound delivery receipts only)
- Messaging profile — URLs configured on the profile
- No URL — Webhook delivery is skipped
Related Webhook Events
Your webhook URL receives more than justmessage.received. For delivery status tracking and other events, see Receiving Webhooks.
| Event | Description |
|---|---|
message.received | Inbound SMS or MMS received (this guide) |
message.sent | Outbound message accepted by carrier |
message.finalized | Final delivery status (delivered, failed, etc.) |
Next Steps
Send Messages
Send outbound SMS and MMS messages
Webhooks Reference
All webhook event types and payload details
Message Encoding
Understand GSM-7, UCS-2, and message segmentation
Auto-Reply with Opt-Out
Handle STOP/HELP keywords automatically