Complete n8n workflow for handling Telnyx inbound calls with AI-powered data collection.
- Receives inbound call webhooks from Telnyx
- Answers the call automatically
- Gathers email address using Telnyx AI (conversational STT + validation)
- Validates the captured email format
- Confirms back to the caller
- Saves to Google Sheets (optional)
- Hangs up gracefully
- Create a Telnyx Call Control Application
- Configure webhook URL:
https://your-n8n-instance.com/webhook/telnyx-inbound - Assign your DID (phone number) to this application
- Copy your Telnyx API Key
- n8n instance running (cloud or self-hosted)
- Import
telnyx-inbound-ai-gather.jsoninto n8n - Configure credentials (see below)
- Go to Settings β Credentials
- Click Add Credential
- Select Header Auth
- Configure:
- Name:
Telnyx API Key - Credential for:
HTTP Request - Name (header):
Authorization - Value:
Bearer YOUR_TELNYX_API_KEY_HERE
- Name:
- Open the workflow in n8n
- Click the Telnyx Webhook node
- Click Listen for Test Event or Execute Workflow
- Copy the webhook URL (e.g.,
https://your-n8n.com/webhook/telnyx-inbound) - Paste this URL into your Telnyx Call Control Application settings
If you want to save captured emails to Google Sheets:
-
Create a Google Sheet with these columns:
timestampfrom_numberto_numberemailemail_validtranscriptcall_session_id
-
In n8n, configure Google Sheets credential:
- Go to Settings β Credentials
- Add Google Sheets OAuth2 API
- Connect your Google account
-
Update the Save to Google Sheets node with your Sheet ID
Inbound Call β [Telnyx Webhook] β [Parse Data] β [Route by Event] β ββββββββββββββββββββββΌβββββββββββββββββββββ β β β [call.initiated] [call.answered] [call.ai_gather.ended] β β β [Answer Call] [Gather Using AI] [Process Results] β β β [Respond 200] [Respond 200] [Validate Email] β βββββββββββββββββββββ΄ββββββββββββββββββββ β β [Email Valid] [Email Invalid] β β [Confirm + Save to Sheets] [Apologize Message] β β [Hangup Success] [Hangup Failed] β β [Respond 200] [Respond 200] Edit the Gather Using AI node to capture different data. Here are examples:
{ "greeting": "Hi! Please tell me your full name and email address.", "parameters": { "type": "object", "properties": { "first_name": { "type": "string", "description": "Caller's first name" }, "last_name": { "type": "string", "description": "Caller's last name" }, "email": { "type": "string", "format": "email", "description": "Caller's email address" } }, "required": ["first_name", "last_name", "email"] }, "voice": "Polly.Joanna", "language": "en-US" }{ "greeting": "Please tell me your callback phone number.", "parameters": { "type": "object", "properties": { "phone": { "type": "string", "pattern": "^\\+?[1-9]\\d{1,14}$", "description": "Phone number in E.164 format" } }, "required": ["phone"] }, "voice": "Polly.Matthew", "language": "en-US" }{ "greeting": "Please provide your full mailing address including street, city, state, and zip code.", "parameters": { "type": "object", "properties": { "street": { "type": "string" }, "city": { "type": "string" }, "state": { "type": "string" }, "zip": { "type": "string", "pattern": "^\\d{5}(-\\d{4})?$" } }, "required": ["street", "city", "state", "zip"] }, "voice": "Polly.Joanna", "language": "en-US" }Call Initiated Event:
curl -X POST "https://your-n8n-instance.com/webhook/telnyx-inbound" \ -H "Content-Type: application/json" \ -d '{ "data": { "event_type": "call.initiated", "payload": { "call_control_id": "test-call-123", "call_session_id": "test-session-456", "from": "+15551234567", "to": "+15559876543", "direction": "incoming", "state": "parked" } } }'AI Gather Ended Event:
curl -X POST "https://your-n8n-instance.com/webhook/telnyx-inbound" \ -H "Content-Type: application/json" \ -d '{ "data": { "event_type": "call.ai_gather.ended", "payload": { "call_control_id": "test-call-123", "call_session_id": "test-session-456", "from": "+15551234567", "to": "+15559876543", "parameters": { "email": "john.doe@example.com" }, "transcript": "My email is john dot doe at example dot com", "status": "completed" } } }'-
Webhook Signatures: Add signature verification in the Parse Webhook Data node:
// Verify Telnyx signature (standard-webhooks) const signature = $request.headers['telnyx-signature-ed25519']; const timestamp = $request.headers['telnyx-timestamp']; const publicKey = 'your-telnyx-public-key'; // Implement Ed25519 signature verification // See: https://developers.telnyx.com/docs/v2/development/webhooks#verify-webhooks
-
Error Handling: Add try-catch blocks and error notifications (email/Slack)
-
Rate Limiting: Monitor concurrent calls and queue if needed
-
Logging: Enable n8n execution logging for debugging
-
Retry Logic: Telnyx automatically retries non-200 responses
The workflow handles these events:
| Event | Description | Action |
|---|---|---|
call.initiated | Inbound call received | Answer the call |
call.answered | Call answered successfully | Start AI gather |
call.ai_gather.ended | AI gather completed | Process results |
call.ai_gather.partial_results | Streaming results | (Optional) Preview |
call.hangup | Call ended | Log/cleanup |
Common Polly voices for voice parameter:
- Female:
Polly.Joanna,Polly.Kendra,Polly.Kimberly,Polly.Salli,Polly.Amy(British) - Male:
Polly.Matthew,Polly.Justin,Polly.Joey,Polly.Brian(British)
- β Check Telnyx Call Control app webhook URL is correct
- β Ensure n8n workflow is active (not paused)
- β Verify DID is assigned to the Call Control application
- β Check n8n webhook is publicly accessible (not localhost)
- β Verify Telnyx API key is correct in credentials
- β
Check
call_control_idis being extracted properly - β Review n8n execution logs for API errors
- β Test with clearer pronunciation
- β Add retry logic for failed gathers
- β
Enable
send_partial_resultsto debug - β
Adjust
greetingfor clearer instructions
- β Move heavy processing (Google Sheets, DB writes) to separate workflow
- β Use n8n's "Split in Batches" or background execution
- Add retry logic for failed email captures
- Implement caller verification (ANI lookup)
- Add SMS confirmation after call
- Store to Redis/database instead of Sheets
- Add call recording
- Implement transfer to live agent if AI fails
MIT - Use freely for your projects!
For Telnyx-specific questions: Telnyx Support For n8n questions: n8n Community