This workflow corresponds to n8n.io template #17658 — we link there as the canonical source.
This workflow follows the Agent → Chainllm recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "wxCegekm6C25JfhD",
"meta": {
"builderVariant": "mcp",
"aiBuilderAssisted": true
},
"name": "Chat with an AI agent that adds and queries leads in your Google Sheet",
"tags": [],
"nodes": [
{
"id": "6fa3b90e-191a-4094-9684-852898b981ac",
"name": "Chat Message Received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
48,
48
],
"parameters": {
"public": true,
"options": {
"title": "CRM Assistant",
"subtitle": "Add and query leads by chatting",
"responseMode": "streaming",
"inputPlaceholder": "Add a lead or ask a question..."
},
"initialMessages": "Hi! I manage your CRM sheet. Try: \"Add Acme Corp, contact Jane, status new\" or \"Who are my qualified leads?\""
},
"typeVersion": 1.4
},
{
"id": "612cc5a3-b380-4df2-91b1-918e073f9411",
"name": "CRM Assistant Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
368,
48
],
"parameters": {
"text": "={{ $json.chatInput }}",
"options": {
"systemMessage": "You are a CRM assistant that manages a Google Sheet of leads. To add a lead, use the Add Lead tool. To answer questions about the pipeline (how many leads, which are qualified, etc.), use the List Leads tool to read the sheet, then answer from the rows. Use the Calculator for counts or totals. Confirm every add in one short sentence. If information is missing, ask a brief follow-up question."
},
"promptType": "define"
},
"typeVersion": 3.1
},
{
"id": "8ad3f01d-a548-4aa6-984f-9ec16ecdfdc5",
"name": "Agent Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
288,
320
],
"parameters": {
"options": {
"temperature": 0.2
},
"modelName": "models/gemini-3.1-flash-lite"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "10b3c4f6-be7d-4ba3-866f-057862722e40",
"name": "Conversation Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
448,
320
],
"parameters": {
"contextWindowLength": 10
},
"typeVersion": 1.4
},
{
"id": "897d806f-8146-43dd-8a73-db0f524ca9ea",
"name": "Add Lead",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
608,
320
],
"parameters": {
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "Leads"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "Select your CRM spreadsheet"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "807680fb-c4b2-46fd-9af6-028ca5d5b820",
"name": "List Leads",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
768,
320
],
"parameters": {
"sheetName": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "Leads"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "Select your CRM spreadsheet"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "f6d21e50-6cb3-4ebf-90f1-2bc62d8fddeb",
"name": "Calculator",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
928,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "e5a7714d-a17e-478e-b4c8-d21c5175a686",
"name": "Tag Intent",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
368,
592
],
"parameters": {
"text": "=Reply with only one word - add, query, update or other - for what this CRM message wants: {{ $json.chatInput }}",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.9
},
{
"id": "3dd15646-ef72-4e10-b1d1-1f69d0b05ea9",
"name": "Intent Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
320,
752
],
"parameters": {
"options": {
"temperature": 0
},
"modelName": "models/gemini-3.1-flash-lite"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "ec7a162f-405b-4555-bc4c-fd4f89d1cdb5",
"name": "Log Interaction",
"type": "n8n-nodes-base.googleSheets",
"position": [
672,
592
],
"parameters": {
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "Chat Log"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "Select your CRM spreadsheet"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "a364b7ff-44cc-43a9-aa31-f6ff45786b9d",
"name": "Overview Sticky",
"type": "n8n-nodes-base.stickyNote",
"position": [
-736,
-160
],
"parameters": {
"width": 664,
"height": 596,
"content": "## Chat with an AI agent that adds and queries leads in your Google Sheet\n\n### How it works\nThis is an AI Agent that actually reads and writes your data, not just a chatbot. Open the built-in chat and talk to your CRM in plain language. The AI Agent, powered by Google Gemini, has three tools: an Add Lead tool that appends a row, a List Leads tool that reads the sheet to answer pipeline questions, and a Calculator for counts and totals. It decides which tool to use, fills the columns from what you typed, and remembers the conversation through a Simple Memory window, so \"add Acme, contact Jane, status new\" and then \"how many new leads do I have?\" both work. In parallel a Basic LLM Chain tags each message intent and logs it, so you can see how the assistant is used.\n\n### Setup\n1. Connect Google Gemini (PaLM) API and Google Sheets.\n2. Point the three Google Sheets nodes at your CRM spreadsheet (tabs: Leads, Chat Log).\n3. Open the chat URL and start managing leads by typing.\n\n### Customization tips\nAdd an Update tool, or connect the same tools to a Telegram or Slack trigger."
},
"typeVersion": 1
},
{
"id": "d3bd420d-6097-4ace-b27d-d0de31bad460",
"name": "S1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
-160
],
"parameters": {
"color": 7,
"width": 1116,
"height": 600,
"content": "## 1. AI Agent with Google Sheets tools\nThe Agent adds rows and reads the sheet through tools, uses the calculator for counts, and remembers the conversation."
},
"typeVersion": 1
},
{
"id": "0028d14f-c44f-4cae-926e-f75042fc5fd7",
"name": "S2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
464
],
"parameters": {
"color": 7,
"width": 1116,
"height": 428,
"content": "## 2. Parallel intent log (Basic LLM Chain)\nA Basic LLM Chain tags each message (add / query / update) and logs it on a separate branch, without blocking the chat reply."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"availableInMCP": true,
"executionOrder": "v1"
},
"versionId": "c7087933-39a6-4ebb-aeb8-729bc4cf47c5",
"nodeGroups": [],
"connections": {
"Add Lead": {
"ai_tool": [
[
{
"node": "CRM Assistant Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Calculator": {
"ai_tool": [
[
{
"node": "CRM Assistant Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"List Leads": {
"ai_tool": [
[
{
"node": "CRM Assistant Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Tag Intent": {
"main": [
[
{
"node": "Log Interaction",
"type": "main",
"index": 0
}
]
]
},
"Agent Model": {
"ai_languageModel": [
[
{
"node": "CRM Assistant Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Intent Model": {
"ai_languageModel": [
[
{
"node": "Tag Intent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Conversation Memory": {
"ai_memory": [
[
{
"node": "CRM Assistant Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Chat Message Received": {
"main": [
[
{
"node": "CRM Assistant Agent",
"type": "main",
"index": 0
},
{
"node": "Tag Intent",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApigoogleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow provides a chat-based CRM assistant powered by Google Gemini that can append new leads to a Google Sheets “Leads” tab, answer pipeline questions by reading the sheet, and log each conversation message and intent to a “Chat Log” tab. Receives a new message through…
Source: https://n8n.io/workflows/17658/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow is designed for growth agencies, SaaS founders, and sales teams who want to move beyond static lead forms. It is ideal for those who need a "living" system that not only captures leads b
teste. Uses chatTrigger, agent, lmChatGroq, memoryBufferWindow. Chat trigger; 24 nodes.
pix-zap. Uses chatTrigger, agent, toolCalculator, toolWikipedia. Chat trigger; 21 nodes.
Agente de NF-3. Uses chatTrigger, compression, agent, memoryBufferWindow. Chat trigger; 12 nodes.
This workflow provides a chat-based research assistant powered by Google Gemini that can look up facts on Wikipedia, do calculations, and remember context, while also tagging each user question and lo