- callin.io version:1.44.1
- Database (default: SQLite): google sheets
- callin.io EXECUTIONS_PROCESS setting (default: own, main):
- Running callin.io via (Docker, npm, callin.io cloud, desktop app): n8ncloud
- Operating system: windows
Hey there, I'm trying to replicate a Google Form in a chat format.
I have set up an AI Agent (tool agent), where I am using an OpenAI model and 2 tools:
-
getQuestions: This tool retrieves all the questions one by one:
json
{
"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": "<a href="https://docs.google.com/spreadsheets/d/1GMqKSI_w_yf6SMX2w_tdASkVJPf2iJhr8bsY6jdTrCE/edit?usp=sharing" rel="noopener nofollow ugc"> https://docs.google.com/spreadsheets/d/1GMqKSI_w_yf6SMX2w_tdASkVJPf2iJhr8bsY6jdTrCE/edit?usp=sharing</a> ;",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "<a href="https://docs.google.com/spreadsheets/d/1GMqKSI_w_yf6SMX2w_tdASkVJPf2iJhr8bsY6jdTrCE/edit#gid=0" rel="noopener nofollow ugc"> https://docs.google.com/spreadsheets/d/1GMqKSI_w_yf6SMX2w_tdASkVJPf2iJhr8bsY6jdTrCE/edit#gid=0</a> ;"
},
"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 ProblemnInstead 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 - 1n }n };n} else {n workflowStaticData.currentQuestionIndex = 0;n return {n questions: {n question: null,n formStamp: null,n response: null,n hasNext: falsen }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": <span class="chcklst-box fa fa-square-o fa-fw"></span>
}
-
SaveResponse: It saves the user response by sending data in the format:
json
{
"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": <span class="chcklst-box fa fa-square-o fa-fw"></span>
}
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:
- getQuestions: call this tool to get questions
- 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 received using step 3, Call the “SaveResponse” tool to save the user response for every question in the format:
json
{
"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.
step 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 users those questions but doesn't trigger the SaveResponse tool, meaning it doesn't 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.
Please provide the rewritten markdown content *it should be in the markdown format.
It seems your topic is missing some crucial details. Could you please provide the following information, if relevant?
- callin.io version:
- Database (default: SQLite):
- callin.io EXECUTIONS_PROCESS setting (default: own, main):
- Running callin.io via (Docker, npm, callin.io cloud, desktop app):
- Operating system:
Please share these details to help us assist you better.
This discussion was automatically closed 90 days following the last response. New replies are no longer permitted.