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