{"meta":{"instanceId":"workflow-e6f4aaf2","versionId":"1.0.0","createdAt":"2025-09-29T07:07:45.509928","updatedAt":"2025-09-29T07:07:45.509936","owner":"n8n-user","license":"MIT","category":"automation","status":"active","priority":"high","environment":"production"},"nodes":[{"id":"9a8d7d07-a1b3-4bca-8e77-10da3a2abc45","name":"Webhook","type":"n8n-nodes-base.webhook","position":[-160,0],"webhookId":"7f35a3a8-54c3-49d7-879d-6c3429f0e5da","parameters":{"path":"retell-dynamic-variables","options":{"ipWhitelist":"100.20.5.228"},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":2,"notes":"This webhook node performs automated tasks as part of the workflow."},{"id":"79e77d72-6e13-428c-ad10-58e6930e2d90","name":"Respond to Webhook","type":"n8n-nodes-base.respondToWebhook","position":[440,0],"parameters":{"options":{},"respondWith":"json","responseBody":"={\n  \"call_inbound\": {\n    \"dynamic_variables\": {\n        \"first_name\": \"{{ $json['First Name'] }}\",\n        \"last_name\": \"{{ $json['Last name'] }}\",\n        \"email\": \"{{ $json['E-Mail'] }}\",\n        \"variable_1\": \"{{ $json['User Variable 1'] }}\",\n        \"variable_2\": \"{{ $json['User Variable 2']}}\"\n    },\n    \"metadata\": {\n    }\n  }\n}"},"typeVersion":1.1,"notes":"This respondToWebhook node performs automated tasks as part of the workflow."},{"id":"10919781-9750-417f-bba6-293bf99dbc3e","name":"Get user in DB by Phone Number","type":"n8n-nodes-base.googleSheets","position":[140,0],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $json.body.call_inbound.from_number }}","lookupColumn":"Phone Number"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"{{ $env.WEBHOOK_URL }}","cachedResultName":"Users"},"documentId":{"__rl":true,"mode":"list","value":"1TYgk8PK5w2l8Q5NtepdyLvgtuHXBHcODy-2hXOPP6AU","cachedResultUrl":"{{ $env.WEBHOOK_URL }}","cachedResultName":"Retell sample UserDB"}},"credentials":{"googleSheetsOAuth2Api":{"id":"ufBkeygvc1l17m5N","name":"Baptiste AS - Google Sheets account"}},"typeVersion":4.5,"notes":"This googleSheets node performs automated tasks as part of the workflow."},{"id":"de9a2ff5-690e-4e1e-ab5c-5a8825986871","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-880,-440],"parameters":{"color":7,"width":601,"height":1105,"content":"## Handle Retell's Inbound call webhooks\n\n## Overview\n- This workflow provides Retell agent builders with a simple way to populate [dynamic variables]({{ $env.WEBHOOK_URL }} using n8n.\n- The workflow fetches user information from a Google Sheet based on the phone number and sends it back to Retell.\n- It is based on Retell's [Inbound Webhook Call]({{ $env.WEBHOOK_URL }}\n- Retell is a service that lets you create Voice Agents that handle voice calls simply, based on a prompt or using a conversational flow builder.\n\n## Prerequisites\n- Have a [Retell AI Account]({{ $env.WEBHOOK_URL }}\n- [Create a Retell agent]({{ $env.WEBHOOK_URL }}\n- [Purchase a phone number]({{ $env.WEBHOOK_URL }} and associate it with your agent\n- Create a Google Sheets - for example, [make a copy of this one]({{ $env.WEBHOOK_URL }}\n- Your Google Sheet must have at least one column with the phone number. The remaining columns will be used to populate your Retell agent’s dynamic variables.\n- All fields are returned as strings to Retell (variables are replaced as text)\n\n## How it works\n- The webhook call is received from Retell. We filter the call using their whitelisted IP address.\n- It extracts data from the webhook call and uses it to retrieve the user from Google Sheets.\n- It formats the data in the response to match Retell's expected format.\n- Retell uses this data to replace [dynamic variables]({{ $env.WEBHOOK_URL }} in the prompts.\n\n\n## How to use it\nSee the description for screenshots!\n- Set the webhook name (keep it as POST).\n- Copy the Webhook URL (e.g., `{{ $env.WEBHOOK_URL }}`) and paste it into Retell's interface. Navigate to \"Phone Numbers\", click on the phone number, and enable \"Add an inbound webhook\".\n- In your prompt (e.g., \"welcome message\"), use the variable with this syntax: `{{variable_name}}` (see [Retell's documentation]({{ $env.WEBHOOK_URL }}\n- These variables will be dynamically replaced by the data in your Google Sheet.\n\n\n## Notes\n- In Google Sheets, the phone number must start with `'+'`.\n- Phone numbers must be formatted like the example: with the `+`, extension, and no spaces.\n- You can use any database—just replace Google Sheets with your own, making sure to keep the phone number formatting consistent.\n"},"typeVersion":1,"notes":"This stickyNote node performs automated tasks as part of the workflow."},{"id":"55b087bf-d51f-4660-94c7-3742915ff79b","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-220,-120],"parameters":{"color":5,"width":220,"height":300,"content":"Change the path if needed"},"typeVersion":1,"notes":"This stickyNote node performs automated tasks as part of the workflow."},{"id":"bd6a7c81-5125-4f46-a1ba-86029d3a0eda","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[80,-120],"parameters":{"color":5,"width":220,"height":300,"content":"Replace with your own Google Sheets, including the dynamic variables of your Retell Agent"},"typeVersion":1,"notes":"This stickyNote node performs automated tasks as part of the workflow."},{"id":"7105c832-ffbe-4d36-90ec-b8c868388c4e","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[380,-120],"parameters":{"color":5,"width":220,"height":300,"content":"Adapt the response to match your Retell dynamic variables"},"typeVersion":1,"notes":"This stickyNote node performs automated tasks as part of the workflow."}],"connections":{"Webhook":{"main":[[],[],[],[],[],[],[],[],[]]},"Respond to Webhook":{"main":[[],[],[],[],[],[],[],[],[]]},"Get user in DB by Phone Number":{"main":[[]]}},"name":"Webhook Workflow","settings":{"executionOrder":"v1","saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner","errorWorkflow":null,"timezone":"UTC","executionTimeout":3600,"maxExecutions":1000,"retryOnFail":true,"retryCount":3,"retryDelay":1000},"description":"Automated workflow: Webhook Workflow. This workflow integrates 5 different services: webhook, stickyNote, respondToWebhook, stopAndError, googleSheets. It contains 12 nodes and follows best practices for error handling and security.","notes":"Excellent quality workflow: Webhook Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}