Describe the problem/error/question
I am trying to make an ai receptionist workflow that pulls a call from eleven labs and twilio. Everything works fine except that the data is not put into google sheets or google calendar.
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
"nodes": [
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
"typeVersion": 1,
"position": [
80,
-352
],
"id": "7c7af45f-749c-42aa-9b68-46505daeb242",
"name": "DeepSeek Chat Model",
"credentials": {
"deepSeekApi": {
"id": "5Q5LjV4NOYcEuRJ2",
"name": "DeepSeek account"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $json.conversation_id }}",
"contextWindowLength": 8
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
192,
-336
],
"id": "f885fdef-eea0-4cd1-872e-276de53eff87",
"name": "Simple Memory"
},
{
"parameters": {
"calendar": {
"__rl": true,
"value": "[email protected]",
"mode": "list",
"cachedResultName": "[email protected]"
},
"start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
"end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', ``, 'string') }}",
"additionalFields": {
"summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', ``, 'string') }}"
}
},
"type": "n8n-nodes-base.googleCalendarTool",
"typeVersion": 1.3,
"position": [
640,
-384
],
"id": "858dfc42-8591-41b2-8a4d-fb524225de4c",
"name": "Create an event in Google Calendar",
"credentials": {
"googleCalendarOAuth2Api": {
"id": "5nmxueO6KW89uKjC",
"name": "Google Calendar account"
}
}
},
{
"parameters": {
"httpMethod": "POST",
"path": "twilio-call",
"responseMode": "responseNode",
"options": {}
},
"name": "TwilioWebhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
-688,
-192
],
"id": "71568fe5-f3a8-4f09-ab9d-7804a7363a00",
"webhookId": "cf3ecfd5-b652-4b07-8017-34cbc95f5ff8"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.SpeechResult || \"Thank you for calling SmartCon. How can I help you today?\" }}",
"options": {
"systemMessage": "=You are an appointment booking assistant for SmartCon.\n\nYour goal is to collect these details step by step:\n1. Full name\n2. Email address \n3. Phone number\n4. Preferred date and time for appointment\n5. Reason for appointment\n\nTOOL USAGE INSTRUCTIONS:\n- ALWAYS use the tools to perform actions. Do NOT just respond with text.\n- When the customer asks about available times: USE the \"Check Available Appointments\" tool.\n- When the customer provides a preferred date/time: ALWAYS USE the \"Check Available Appointments\" tool FIRST to check for conflicts.\n- When ready to book: USE the \"Book New Appointment\" tool with ALL collected information.\n- AFTER booking the appointment: USE the \"Create an event in Google Calendar\" tool to add it to the calendar.\n\nSCHEDULING RULES:\n- Business hours: 9:00 AM to 5:00 PM, Monday to Friday\n- Appointments are 1-hour slots on the hour (9:00, 10:00, 11:00, etc.)\n- NEVER double-book — always check availability first\n\nCONVERSATION FLOW:\n- Ask for ONE piece of information at a time.\n- After the customer provides info, acknowledge briefly and ask the next question.\n- For date/time: Check availability, offer alternatives if needed.\n- Once ALL info is collected AND time is confirmed available:\n 1. Call the \"Book New Appointment\" tool\n 2. Then call the \"Create an event in Google Calendar\" tool\n- End with: \"Perfect! Your appointment has been booked for [date] at [time]. We will send confirmation shortly.\"\n\nIMPORTANT:\n- You MUST use the tools to check availability and book appointments.\n- Do NOT just collect information — actually use the tools to complete the booking process.\n- NEVER skip the availability check before booking.\n- NEVER book without creating a calendar event.\n\nExample interaction:\nUser: \"I want to book April 5th at 10am\"\nAssistant: (calls \"Check Available Appointments\" tool)\nAssistant: \"That time is available. What is your name?\"\nUser: \"John Doe\"\nAssistant: \"Thanks John. What is your email?\"\n... (collects all info) ...\nAssistant: (calls \"Book New Appointment\" tool)\nAssistant: (calls \"Create an event in Google Calendar\" tool)\nAssistant: \"Perfect! Your appointment is booked for April 5th at 10am.\"\nWhen ready to book, extract these EXACT fields:\n- name (full name)\n- email \n- phone\n- date (YYYY-MM-DD format)\n- time (HH:MM format, 24-hour)\n- reason\n\nThen call tools in this order:\n1. \"Check Available Appointments\" \n2. \"Book New Appointment\" with name/email/phone/reason\n3. \"Create an event in Google Calendar\" with date/time/name\n\nToday's Date: {{ $now.format('YYYY-MM-DD') }}\nCurrent Time: {{ $now.format('HH:mm') }}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
96,
-624
],
"id": "079ec07f-a8c4-43f9-ad7e-4e5ed560d7a5",
"name": "AI Agent"
},
{
"parameters": {
"jsCode": "// Fixed n8n Code Node - Process ElevenLabs Transcript\nconst inputData = $input.all();\n\nconst processedItems = inputData.map(item => {\n const data = item.json;\n \n // Extract transcript from the nested structure\n const transcript = data.body?.data?.transcript || [];\n const metadata = data.body?.data?.metadata || {};\n const analysis = data.body?.data?.analysis || {};\n \n // Get the last user message for the AI agent to respond to\n const lastUserMessage = transcript\n .filter(msg => msg.role === 'user')\n .pop()?.message || '';\n \n // Build the transcript text for storage\n let transcriptText = '';\n transcriptText += `=== CALL TRANSCRIPT ===\\n`;\n transcriptText += `Call ID: ${data.body?.data?.conversation_id || 'N/A'}\\n`;\n transcriptText += `Duration: ${metadata.call_duration_secs || 0} seconds\\n`;\n transcriptText += `Date: ${new Date((metadata.start_time_unix_secs || 0) * 1000).toLocaleString()}\\n`;\n transcriptText += `Phone Numbers: ${metadata.phone_call?.external_number || 'N/A'} → ${metadata.phone_call?.agent_number || 'N/A'}\\n`;\n transcriptText += `Summary: ${analysis.transcript_summary || 'No summary available'}\\n`;\n transcriptText += `\\n=== CONVERSATION ===\\n\\n`;\n \n // Process each message in the transcript\n transcript.forEach((message, index) => {\n const role = message.role === 'agent' ? 'AGENT' : 'USER';\n const timeStamp = message.time_in_call_secs || 0;\n const messageText = message.message || '';\n transcriptText += `[${timeStamp}s] ${role}: ${messageText}\\n`;\n });\n \n transcriptText += `\\n=== END OF TRANSCRIPT ===`;\n \n // Check if this is a completed call (has analysis)\n const isCompletedCall = data.body?.type === 'post_call_transcription';\n \n return {\n json: {\n // For AI Agent response (only if call is ongoing)\n SpeechResult: isCompletedCall ? '' : lastUserMessage,\n \n // For transcript storage (when call is complete)\n conversation_id: data.body?.data?.conversation_id,\n call_duration: metadata.call_duration_secs,\n start_time: new Date((metadata.start_time_unix_secs || 0) * 1000).toISOString(),\n caller_number: metadata.phone_call?.external_number,\n agent_number: metadata.phone_call?.agent_number,\n transcript_text: transcriptText,\n summary: analysis.transcript_summary,\n call_successful: analysis.call_successful,\n message_count: transcript.length,\n termination_reason: metadata.termination_reason,\n \n // Flag to determine workflow path\n is_completed_call: isCompletedCall,\n \n // Raw data for debugging\n raw_webhook_data: data\n }\n };\n});\n\nreturn processedItems;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-432,
-192
],
"id": "8e5ab4b5-b629-4a35-b8fa-6989ca0cdc5e",
"name": "Code in JavaScript"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "c89b5ae1-81ad-4bcf-8e73-6b33f24f9a9d",
"leftValue": "={{ $json.is_completed_call }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equal"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
-240,
-192
],
"id": "c04e97d4-7ceb-4c05-b623-6e4c662dccc2",
"name": "Check Call Status1"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1-2lwhO5L4kjzdDev2SNp89FOd0LGZHyNHR4dfOri078",
"mode": "list",
"cachedResultName": "transcripts",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-2lwhO5L4kjzdDev2SNp89FOd0LGZHyNHR4dfOri078/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-2lwhO5L4kjzdDev2SNp89FOd0LGZHyNHR4dfOri078/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {},
"matchingColumns": [],
"schema": [
{
"id": "conversation_id",
"displayName": "conversation_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "call_duration",
"displayName": "call_duration",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "start_time",
"displayName": "start_time",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "caller_number",
"displayName": "caller_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "agent_number",
"displayName": "agent_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "transcript_text",
"displayName": "transcript_text",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "summary",
"displayName": "summary",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "call_successful",
"displayName": "call_successful",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "message_count",
"displayName": "message_count",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "termination_reason",
"displayName": "termination_reason",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
48,
-64
],
"id": "83babdd8-de4b-4851-a1cd-1d5214b2620c",
"name": "Store Call Transcript1",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "iVp5jBMtdLO697gb",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"respondWith": "text",
"responseBody": "={{ $json.output }}",
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
608,
-624
],
"id": "aab41622-67b7-43ba-8537-3ebce610b2fe",
"name": "Respond to ElevenLabs1"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1k1e5cVbkW_AZFwBDUeiic21LpEwr-0as_ExteSdJ9WA",
"mode": "list",
"cachedResultName": "smartcontest",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1k1e5cVbkW_AZFwBDUeiic21LpEwr-0as_ExteSdJ9WA/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 1471493767,
"mode": "list",
"cachedResultName": "appointment",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1k1e5cVbkW_AZFwBDUeiic21LpEwr-0as_ExteSdJ9WA/edit#gid=1471493767"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('name', ``, 'string') }}",
"email": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('email', ``, 'string') }}",
"phone": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('phone', ``, 'string') }}",
"reason": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('reason', ``, 'string') }}"
},
"matchingColumns": [
"row_number"
],
"schema": [
{
"id": "name",
"displayName": "name",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "email",
"displayName": "email",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "phone",
"displayName": "phone",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "reason",
"displayName": "reason",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheetsTool",
"typeVersion": 4.7,
"position": [
448,
-352
],
"id": "d24357de-a586-48e8-8774-08b2cfeede4a",
"name": "Book New Appointment",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "iVp5jBMtdLO697gb",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "1k1e5cVbkW_AZFwBDUeiic21LpEwr-0as_ExteSdJ9WA",
"mode": "list",
"cachedResultName": "smartcontest",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1k1e5cVbkW_AZFwBDUeiic21LpEwr-0as_ExteSdJ9WA/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 1471493767,
"mode": "list",
"cachedResultName": "appointment",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1k1e5cVbkW_AZFwBDUeiic21LpEwr-0as_ExteSdJ9WA/edit#gid=1471493767"
},
"options": {}
},
"type": "n8n-nodes-base.googleSheetsTool",
"typeVersion": 4.7,
"position": [
320,
-352
],
"id": "b51b4177-8c1b-403a-82be-c3c6b88708ee",
"name": "Check Available Appointments",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "iVp5jBMtdLO697gb",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"jsCode": "// Debug: Check what data the AI Agent is receiving\n// Add this as a Code node BEFORE the AI Agent to see the data\n\nconsole.log('=== AI AGENT INPUT DEBUG ===');\nconsole.log('Raw input data:', JSON.stringify($input.all(), null, 2));\n\n// Check specific fields the AI needs\nconst data = $input.first().json;\nconsole.log('SpeechResult:', data.SpeechResult);\nconsole.log('Conversation ID:', data.conversation_id);\nconsole.log('Is completed call:', data.is_completed_call);\n\n// Return the data unchanged for the AI Agent\nreturn $input.all();"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-128,
-592
],
"id": "a3ef4793-faba-4fcb-a99e-318268b1ad43",
"name": "Code in JavaScript1"
}
],
"connections": {
"DeepSeek Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Create an event in Google Calendar": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"TwilioWebhook": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Respond to ElevenLabs1",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Check Call Status1",
"type": "main",
"index": 0
}
]
]
},
"Check Call Status1": {
"main": [
[
{
"node": "Store Call Transcript1",
"type": "main",
"index": 0
}
],
[
{
"node": "Code in JavaScript1",
"type": "main",
"index": 0
}
]
]
},
"Book New Appointment": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Check Available Appointments": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "b9b2bc6dff92cd1feb586fca729368ac36db82c68929ef6752faab3fa14691c9"
}
}
Share the output returned by the last node
Information on your n8n setup
-
n8n version:
-
Database (default: SQLite):
-
n8n EXECUTIONS_PROCESS setting (default: own, main):
-
Running n8n via (Docker, npm, n8n cloud, desktop app):
-
Operating system:
