Describe the problem/error/question
I am trying to run the workflow below which takes the following payload from the webhook and schedules an appointment in google calendar -
{
“Full_Name”: “Rohit Ramesh”,
“Phone”: “+14123788780”,
“preferred_time”: “August 16th, 9 AM”
}
However, the appointment is booked correctly sometimes and sometimes it says slot is booked even if its not. The workflow runs succesfully though so no issues there.
What is the error message (if any)?
Please share your workflow
{
“nodes”: [
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $json[“sessionId”] || $json[“Phone”] || $json[“Full_Name”] || $executionId }}”,
“contextWindowLength”: 1
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
-32,
1008
],
“id”: “69e9e526-6048-4954-ab15-54cff047e668”,
“name”: “Simple Memory”,
“notesInFlow”: false
},
{
“parameters”: {
“model”: {
“__rl”: true,
“value”: “gpt-4-turbo”,
“mode”: “list”,
“cachedResultName”: “gpt-4-turbo”
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
-160,
1008
],
“id”: “a59c382e-7033-4090-808e-ccb89c919f79”,
“name”: “OpenAI Chat Model1”,
“credentials”: {
“openAiApi”: {
“id”: “MTFgzH1dOlBNhqrG”,
“name”: “OpenAi account 2”
}
}
},
{
“parameters”: {
“operation”: “getAll”,
“calendar”: {
“__rl”: true,
“value”: “[email protected]”,
“mode”: “list”,
“cachedResultName”: “[email protected]”
},
“returnAll”: true,
“timeMax”: “={{ $now.plus({ week: 4 }) }}”,
“options”: {
“timeZone”: {
“__rl”: true,
“value”: “America/New_York”,
“mode”: “list”,
“cachedResultName”: “America/New_York”
}
}
},
“type”: “n8n-nodes-base.googleCalendarTool”,
“typeVersion”: 1.3,
“position”: [
96,
1008
],
“id”: “b0a190b9-99c1-45ac-85a7-9bf38d86954d”,
“name”: “get_calendar”,
“credentials”: {
“googleCalendarOAuth2Api”: {
“id”: “EaWwgOOIsYr9rgqq”,
“name”: “Google Calendar account 2”
}
}
},
{
“parameters”: {
“respondWith”: “allIncomingItems”,
“options”: {}
},
“type”: “n8n-nodes-base.respondToWebhook”,
“typeVersion”: 1.4,
“position”: [
432,
784
],
“id”: “d2762261-7936-4074-b5d9-078ab989331c”,
“name”: “Respond to Webhook”
},
{
“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”: {
“description”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘Description’, , 'string') }}", "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', , ‘string’) }}”
}
},
“type”: “n8n-nodes-base.googleCalendarTool”,
“typeVersion”: 1.3,
“position”: [
224,
1008
],
“id”: “eb4c4e3f-760d-42e2-9c8b-b4dcb1138961”,
“name”: “post_calendar”,
“alwaysOutputData”: true,
“credentials”: {
“googleCalendarOAuth2Api”: {
“id”: “EaWwgOOIsYr9rgqq”,
“name”: “Google Calendar account 2”
}
}
},
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “Schedule-appointment”,
“responseMode”: “responseNode”,
“options”: {}
},
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 2.1,
“position”: [
-384,
784
],
“id”: “888a7996-21fb-4645-aaba-eadec6f64909”,
“name”: “Webhook”,
“webhookId”: “08f1e90c-ed98-459d-a643-3c2084285c9b”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “=Hi, I would like to schedule an appointment.\n\nFull Name: {{ $json.body.Full_Name }}\nPhone: {{ $json.body.Phone }}\nPreferred Time: {{ $json.body.Preferred_time }}\nOther Notes: {{ $json.body.Other_information }}\n\nAlready Booked Slots:\n{{ $json[“response”].map(e => e.start.dateTime + " to " + e.end.dateTime).join(“\n”) }}\n\nIf the preferred slot is not available, schedule an alternative. Otherwise, suggest the next closest available slot between 9 AM and 5 PM.”,
“options”: {
“systemMessage”: “# Task\nYou are a scheduling assistant. Your job is to book appointments using Google Calendar.\n\n# Rules\n- Call get_calendar first to retrieve existing appointments\n- Check if the user’s preferred time is available\n- If available, schedule the event for 30 mins\n- If not, suggest the nearest available time between 9 AM and 5 PM\n- Use post_calendar only after confirming availability”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.9,
“position”: [
-48,
784
],
“id”: “68b824cd-1b4d-4f4f-81fc-987f499d2334”,
“name”: “AI Agent”,
“alwaysOutputData”: true
}
],
“connections”: {
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “AI Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“OpenAI Chat Model1”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“get_calendar”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“post_calendar”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Webhook”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Respond to Webhook”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “34ced75dd427ccf2d045c820903395fe9550d469232d0c251dd21db4b39a9775”
}
}
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: