Google form Replication in chat format and problem with triggering tool

  • n8n version:1.44.1
  • Database (default: SQLite): google sheets
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8ncloud
  • Operating system: windows

Hey there, i am trying to replicate a google form in a chat format.

i have setup an ai Agent(tool agent), where i am using openai model and 2 tools:

1.getQuestions** : this tool retrieves all the questions one by one:
{
“name”: “getNextquestion”,
“nodes”: [
{
“parameters”: {},
“id”: “31818f6a-7673-4e35-a0fe-29c0b117a6d3”,
“name”: “Execute Workflow Trigger”,
“type”: “n8n-nodes-base.executeWorkflowTrigger”,
“typeVersion”: 1,
“position”: [
620,
460
]
},
{
“parameters”: {
“documentId”: {
“__rl”: true,
“value”: “https://docs.google.com/spreadsheets/d/1GMqKSI_w_yf6SMX2w_tdASkVJPf2iJhr8bsY6jdTrCE/edit?usp=sharing”,
“mode”: “url”
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Sheet1”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1GMqKSI_w_yf6SMX2w_tdASkVJPf2iJhr8bsY6jdTrCE/edit#gid=0
},
“options”: {}
},
“id”: “157320bc-2595-4750-8f3b-1230a43bb45a”,
“name”: “Google Sheets”,
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.3,
“position”: [
800,
460
],
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “D6r6iiuC0xPX6HXq”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“content”: “## Optimization Problem\nInstead of using sheets we can use set node to create the questions list .\n”
},
“id”: “a2d3bac1-3389-462f-aa8d-3b0fadbce78d”,
“name”: “Sticky Note”,
“type”: “n8n-nodes-base.stickyNote”,
“typeVersion”: 1,
“position”: [
1300,
220
]
},
{
“parameters”: {
“jsCode”: “const questions = items.map(item => ({\n question: item.json.Questions,\n formStamp: item.json.Form_stamp,\n response: ""\n}));\nreturn [{ json: { questions } }];”
},
“id”: “fe34be04-03c6-4c29-a43f-485ce617bd89”,
“name”: “Code”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
960,
460
]
},
{
“parameters”: {
“jsCode”: “const workflowStaticData = $getWorkflowStaticData(‘global’);\nlet currentIndex = workflowStaticData.currentQuestionIndex || 0;\nconst questions = $input.all()[0].json.questions;\nif (currentIndex < questions.length) {\n const question = questions[currentIndex];\n workflowStaticData.currentQuestionIndex = currentIndex + 1;\n return {\n questions: {\n question: question.question,\n formStamp: question.formStamp,\n response: "",\n hasNext: currentIndex < questions.length - 1\n }\n };\n} else {\n workflowStaticData.currentQuestionIndex = 0;\n return {\n questions: {\n question: null,\n formStamp: null,\n response: null,\n hasNext: false\n }\n };\n}”
},
“id”: “676ce54a-6cb1-4ef1-9e6c-35747b6c5682”,
“name”: “Code1”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
1240,
460
]
}
],
“pinData”: {},
“connections”: {
“Execute Workflow Trigger”: {
“main”: [
[
{
“node”: “Google Sheets”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Sheets”: {
“main”: [
[
{
“node”: “Code”,
“type”: “main”,
“index”: 0
}
]
]
},
“Code”: {
“main”: [
[
{
“node”: “Code1”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: false,
“settings”: {
“executionOrder”: “v1”
},
“versionId”: “dbdc5766-870d-479a-be37-23c5e9ccd510”,
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “7ef1a6c483aa3ddd44099fdc9d20005875a6d941c4719e9c052317adf9bec202”
},
“id”: “hpftegnSmA3SMfJN”,
“tags”:
}

  1. SaveResponse: it saves the user response by sending data in the format:
    {
    “name”: “SaveResponse”,
    “nodes”: [
    {
    “parameters”: {},
    “id”: “c278734e-db23-4fae-bdde-0753c7b999be”,
    “name”: “Execute Workflow Trigger”,
    “type”: “n8n-nodes-base.executeWorkflowTrigger”,
    “typeVersion”: 1,
    “position”: [
    180,
    400
    ]
    },
    {
    “parameters”: {
    “outputFieldName”: “Zeitstempel”,
    “options”: {}
    },
    “id”: “ca6ce389-c3ed-4f53-962a-b8908ca30845”,
    “name”: “Date & Time”,
    “type”: “n8n-nodes-base.dateTime”,
    “typeVersion”: 2,
    “position”: [
    440,
    240
    ]
    },
    {
    “parameters”: {
    “assignments”: {
    “assignments”: [
    {
    “id”: “8556a4ec-8924-4537-b0e4-e6d7d7189258”,
    “name”: “={{ $input.formStamp }}”,
    “value”: “={{ $input.response }}”,
    “type”: “string”
    }
    ]
    },
    “options”: {}
    },
    “id”: “a5f35b32-d2dd-444d-8243-ce7d98ff1a7e”,
    “name”: “Edit Fields”,
    “type”: “n8n-nodes-base.set”,
    “typeVersion”: 3.3,
    “position”: [
    440,
    420
    ]
    },
    {
    “parameters”: {
    “mode”: “combine”,
    “combinationMode”: “multiplex”,
    “options”: {}
    },
    “id”: “f49af629-d4a9-401d-9f13-f13d7d157706”,
    “name”: “Merge”,
    “type”: “n8n-nodes-base.merge”,
    “typeVersion”: 2.1,
    “position”: [
    680,
    340
    ]
    }
    ],
    “pinData”: {},
    “connections”: {
    “Execute Workflow Trigger”: {
    “main”: [
    [
    {
    “node”: “Date & Time”,
    “type”: “main”,
    “index”: 0
    },
    {
    “node”: “Edit Fields”,
    “type”: “main”,
    “index”: 0
    }
    ]
    ]
    },
    “Date & Time”: {
    “main”: [
    [
    {
    “node”: “Merge”,
    “type”: “main”,
    “index”: 0
    }
    ]
    ]
    },
    “Edit Fields”: {
    “main”: [
    [
    {
    “node”: “Merge”,
    “type”: “main”,
    “index”: 1
    }
    ]
    ]
    }
    },
    “active”: false,
    “settings”: {
    “executionOrder”: “v1”
    },
    “versionId”: “98ef0166-746e-4472-a7be-848bc4ea64d8”,
    “meta”: {
    “templateCredsSetupCompleted”: true,
    “instanceId”: “7ef1a6c483aa3ddd44099fdc9d20005875a6d941c4719e9c052317adf9bec202”
    },
    “id”: “11AFvTBsTkfIxUi5”,
    “tags”:
    }

Here is the prompt i have given it:

You are a survey bot designed to ask questions and collect responses from users.
Always be polite and professional in your interactions. If a user asks for clarification on a question, you may rephrase it slightly, but do not change its meaning. If a user refuses to answer a question, respect their decision and move on to the next question.

Tools to use:

  1. getQuestions: call this tool to get questions
  2. SaveResponse: call this tool to save the user response in a specific format

Follow these steps precisely:

step 1. Use the “getQuestions” tool to fetch questions. This tool will return a JSON object with “question”, “formStamp”,“response” and “hasNext” fields.

step 2. Ask the user the question received from the tool. Use the exact wording provided in the “question” field.

step 3. Wait for the user response and replace “response” with user response.

step 4. When user response is recieved using step 3, Call the “SaveResponse” tool to save the user response for every question in the format:
{
“formStamp”: extracted from “getQuestions” tool,
“response”: update in step 3.
}
send this as input for the “SaveResponse” tool.

step 5. Repeat steps 1-4 until the “getQuestions” tool returns “hasNext”: false.

steo 6. When all questions have been asked (i.e., “hasNext” is false), thank the user for their participation and inform them that the survey is complete.
Remember, your primary goal is to collect accurate responses for each question provided by the “getQuestions” tool and save them using “SaveResponse”

Problem I am facing:
The Ai Agent cycles through questions and asks user those questions but doesnt trigger the SaveResponse tool that is it doesnt send the data to the tool or call the tool at all.

How can i tackle this problem? I would really appreciate help with this.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system: