Skip to content

Instantly share code, notes, and snippets.

@RayyanNafees
Created December 15, 2025 14:41
Show Gist options
  • Select an option

  • Save RayyanNafees/d33742440964d761ff8f7934b87f483a to your computer and use it in GitHub Desktop.

Select an option

Save RayyanNafees/d33742440964d761ff8f7934b87f483a to your computer and use it in GitHub Desktop.
{
"name": "Receive Retell AI Call Data",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "retell-call-data",
"responseMode": "responseNode",
"options": {}
},
"id": "bdb70a97-702d-45f5-9e07-03fb0294e127",
"name": "Webhook - Retell AI",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
-10480,
1472
],
"webhookId": "retell-ai-calls",
"disabled": true
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.call.call_status }}",
"operation": "equals",
"value2": "ended"
}
]
}
},
"id": "1c245cd3-4e7a-4df6-9b78-983bcfd1f59f",
"name": "IF Call Ended",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-10256,
1472
],
"disabled": true
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "call_id",
"value": "={{ $json.call.call_id }}"
},
{
"name": "duration",
"value": "={{ $json.call.end_timestamp - $json.call.start_timestamp }}"
},
{
"name": "transcript",
"value": "={{ $json.call.transcript }}"
},
{
"name": "call_status",
"value": "={{ $json.call.disconnect_reason }}"
},
{
"name": "recording_url",
"value": "={{ $json.call.recording_url }}"
},
{
"name": "caller_number",
"value": "={{ $json.call.from_number }}"
},
{
"name": "to_number",
"value": "={{ $json.call.to_number }}"
},
{
"name": "call_summary",
"value": "{{ $json.call.call_analysis.call_summary }}"
}
]
},
"options": {}
},
"id": "df2b2f21-092d-4368-b779-6fcbd523b9bd",
"name": "Extract Call Data",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
-10032,
1376
],
"disabled": true
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1WW7jg-aYnGsZEGjXc8MDvOtTsrtrBXG40_SyXt_tWwE",
"mode": "list",
"cachedResultName": "Call Data From Retell",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WW7jg-aYnGsZEGjXc8MDvOtTsrtrBXG40_SyXt_tWwE/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WW7jg-aYnGsZEGjXc8MDvOtTsrtrBXG40_SyXt_tWwE/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"call_id": "={{ $json.call_id }}",
"duration": "={{ $json.duration }}",
"transcript": "={{ $json.transcript }}"
},
"matchingColumns": [],
"schema": [
{
"id": "call_id",
"displayName": "call_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "duration",
"displayName": "duration",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "transcript",
"displayName": "transcript",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"id": "3cb0fe09-f7be-43d8-838f-34e23f632d8a",
"name": "Save to Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4,
"position": [
-9808,
1376
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "gCOELSOHY7JJ99fs",
"name": "Google Sheets account 2"
}
},
"disabled": true
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { \"success\": true, \"message\": \"Call data received\" } }}",
"options": {}
},
"id": "a0dcc68e-28ff-46fc-a05e-76008e2ec803",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
-9584,
1376
],
"disabled": true
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { \"success\": true, \"message\": \"Event ignored\" } }}",
"options": {}
},
"id": "939a28da-69f3-4a49-8449-890ac5f452e3",
"name": "Respond - Other Events",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
-10032,
1568
],
"disabled": true
},
{
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 9
}
]
}
},
"id": "1d58047e-9374-4add-a5a2-040cc0587485",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.3,
"position": [
-10480,
1792
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "id-1",
"name": "retellAgentId",
"value": "agent_41e573302d44b9f30af8998c86",
"type": "string"
},
{
"id": "id-2",
"name": "retellFromNumber",
"value": "+1(512)559-1629",
"type": "string"
},
{
"id": "id-3",
"name": "retellApiUrl",
"value": "https://api.retellai.com/v2/create-phone-call",
"type": "string"
}
]
},
"includeOtherFields": true,
"options": {}
},
"id": "b7c19557-acc5-47d1-b93a-d0cb0532344d",
"name": "Workflow Configuration",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-10256,
1792
]
},
{
"parameters": {
"documentId": {
"__rl": true,
"mode": "id",
"value": "1fkC9sLGvz4AB0hTORiRM_Tf2ebVagPinub3maCY_cco"
},
"sheetName": {
"__rl": true,
"mode": "name",
"value": "Sheet1"
},
"options": {}
},
"id": "dcd07827-8830-4023-a3ea-e7d8324879a8",
"name": "Get Phone Numbers from Sheet",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
-10032,
1792
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "gCOELSOHY7JJ99fs",
"name": "Google Sheets account 2"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "id-1",
"name": "phoneNumbers",
"value": "={{ [$json[\"Phone Number 1\"], $json[\"Phone Number 2\"], $json[\"Phone Number 3\"], $json[\"Phone Number 4\"]].filter(num => num && num.toString().trim() !== \"\") }}",
"type": "array"
}
]
},
"includeOtherFields": true,
"options": {}
},
"id": "c50bfa38-acbc-4743-94f9-743656dd5315",
"name": "Prepare Phone Numbers",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-9808,
1792
]
},
{
"parameters": {
"method": "POST",
"url": "={{ $('Workflow Configuration').first().json.retellApiUrl }}",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ { \"from_number\": $('Workflow Configuration').first().json.retellFromNumber, \"to_number\": $json.phoneNumber, \"override_agent_id\": $('Workflow Configuration').first().json.retellAgentId } }}",
"options": {
"batching": {
"batch": {
"batchSize": 1,
"batchInterval": 2000
}
}
}
},
"id": "613432fb-65d3-44e2-a79a-00ca6a848826",
"name": "Call Retell API",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
-9360,
1792
],
"credentials": {
"httpHeaderAuth": {
"id": "858aT8S2cgGnaKfx",
"name": "Header Auth account"
}
}
},
{
"parameters": {
"jsCode": "// Get all input items\nconst items = $input.all();\n\n// Array to store the new items\nconst newItems = [];\n\n// Function to format phone number to E.164 format\nfunction formatToE164(phoneNumber) {\n // Convert to string and trim whitespace\n let formatted = String(phoneNumber).trim();\n \n // If it doesn't start with '+', prepend it\n if (!formatted.startsWith('+')) {\n formatted = '+91' + formatted;\n }\n \n return formatted;\n}\n\n// Iterate through each input item\nfor (const item of items) {\n const phoneNumbers = item.json.phoneNumbers;\n \n // Check if phoneNumbers exists and is an array\n if (Array.isArray(phoneNumbers)) {\n // Create a new item for each phone number\n for (const phoneNumber of phoneNumbers) {\n // Create a copy of the original item's data\n const newItem = {\n json: {\n ...item.json,\n phoneNumber: formatToE164(phoneNumber)\n }\n };\n \n newItems.push(newItem);\n }\n }\n}\n\nreturn newItems;"
},
"id": "c4dee0a2-4be9-4667-b5a5-408f91a0b5bf",
"name": "Split Phone Numbers into Items",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-9584,
1792
]
}
],
"pinData": {
"Schedule Trigger": [
{
"json": {
"timestamp": "2025-12-15T19:20:16.124+05:30",
"Readable date": "December 15th 2025, 7:20:16 pm",
"Readable time": "7:20:16 pm",
"Day of week": "Monday",
"Year": "2025",
"Month": "December",
"Day of month": "15",
"Hour": "19",
"Minute": "20",
"Second": "16",
"Timezone": "Asia/Calcutta (UTC+05:30)"
}
}
]
},
"connections": {
"Webhook - Retell AI": {
"main": [
[
{
"node": "IF Call Ended",
"type": "main",
"index": 0
}
]
]
},
"IF Call Ended": {
"main": [
[
{
"node": "Extract Call Data",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond - Other Events",
"type": "main",
"index": 0
}
]
]
},
"Extract Call Data": {
"main": [
[
{
"node": "Save to Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Save to Google Sheets": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Workflow Configuration",
"type": "main",
"index": 0
}
]
]
},
"Workflow Configuration": {
"main": [
[
{
"node": "Get Phone Numbers from Sheet",
"type": "main",
"index": 0
}
]
]
},
"Get Phone Numbers from Sheet": {
"main": [
[
{
"node": "Prepare Phone Numbers",
"type": "main",
"index": 0
}
]
]
},
"Prepare Phone Numbers": {
"main": [
[
{
"node": "Split Phone Numbers into Items",
"type": "main",
"index": 0
}
]
]
},
"Split Phone Numbers into Items": {
"main": [
[
{
"node": "Call Retell API",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "bc0a9510-57b7-4a3e-8f7a-d8fd59e271ea",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "16ac9a63a1358c34f0f202fba604d009eb8cddb0d714b7bfb01d7318a26b505e"
},
"id": "5Yp65fyC36YTpDjS",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment