This workflow corresponds to n8n.io template #16117 — we link there as the canonical source.
This workflow follows the Agent → Chat Trigger 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": "pXWIMnWufYFEbTaV",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Personal AI Knowledge Base Chatbot \u2014 Google Sheets Skills Store + GPT-4o-mini + Session Memory",
"tags": [],
"nodes": [
{
"id": "3bfda97c-bb00-4e0f-aa67-b94acdfd3f7b",
"name": "Overview",
"type": "n8n-nodes-base.stickyNote",
"position": [
-496,
-32
],
"parameters": {
"color": 4,
"width": 508,
"height": 1316,
"content": "## Personal AI Knowledge Base Chatbot \u2014 Google Sheets Skills Store + GPT-4o-mini + Session Memory\n\nFor solopreneurs, agencies, and teams who want a customizable AI chatbot whose behavior is entirely controlled by a Google Sheet \u2014 no code changes needed, ever. Each row in the sheet is one skill with a name, trigger phrases, and exact instructions. When a user sends a message in the built-in n8n chat interface, the AI reads all active skills, finds the best match using trigger phrases, and responds strictly following those instructions \u2014 not general AI knowledge. Conversation context is maintained across messages using session memory.\n\nThis is simpler than GitHub-based skill systems: skills live in Google Sheets, anyone on the team can edit them, no API tokens for external repos are needed, and new skills go live immediately without redeploying anything.\n\n## How it works\n- **1. Chat Trigger** receives each message from the built-in n8n chat interface\n- **2. Google Sheets \u2014 Load Active Skills** reads all rows from the Skills tab \u2014 only rows with Active = Yes are used\n- **3. Code \u2014 Format Skills for Agent** filters to Active rows only, formats each skill as a labeled block with name, trigger phrases, instructions, and optional example output\n- **4. AI Agent \u2014 Skills Executor** matches the user message to the correct skill using trigger phrases and responds following that skill's instructions exactly. If no skill matches it lists available skills instead of using general AI knowledge\n- **OpenAI \u2014 GPT-4o-mini Model** language model attached to the AI Agent\n- **Session Memory** maintains conversation context across multiple messages in the same session\n- **5. Respond to Chat** sends the agent output back to the chat interface\n\n## Google Sheets setup\nCreate one Google Sheet with a tab named Skills and these column headers in row 1:\nSkill Name | Trigger Phrases | Instructions | Example Output | Active\n\nExample skill rows:\n- Skill Name: Write SEO Blog Post | Trigger Phrases: write blog, SEO article, blog post | Instructions: Write an 800-word SEO blog post with H2 headings, meta description, and keyword in first paragraph. Tone: professional. | Active: Yes\n- Skill Name: Summarize Text | Trigger Phrases: summarize, summary, tldr, shorten | Instructions: Summarize the provided text in 3-5 bullet points. Keep each point under 15 words. | Active: Yes\n- Skill Name: Write Cold Email | Trigger Phrases: cold email, outreach email, sales email | Instructions: Write a short 3-paragraph cold email. Line 1: personalized opener. Line 2: value proposition. Line 3: clear CTA. | Active: Yes\n\n## Set up steps\n1. Create the Google Sheet with the Skills tab and column headers as described above\n2. In **2. Google Sheets \u2014 Load Active Skills** \u2014 connect Google Sheets OAuth2 credential and replace `YOUR_SKILLS_SHEET_ID`\n3. In **OpenAI \u2014 GPT-4o-mini Model** \u2014 connect your OpenAI API credential\n4. Activate the workflow and open the Chat Trigger URL to test"
},
"typeVersion": 1
},
{
"id": "9a293885-5421-44a3-9144-abbe3e3ccd70",
"name": "Section \u2014 Chat Trigger",
"type": "n8n-nodes-base.stickyNote",
"position": [
96,
256
],
"parameters": {
"color": 5,
"width": 372,
"height": 292,
"content": "## Chat Trigger\nBuilt-in n8n chat interface. No frontend needed. Activate the workflow and open the Chat Trigger URL to start a conversation."
},
"typeVersion": 1
},
{
"id": "0716e3e5-c82e-42bb-823a-8a2e074bd09a",
"name": "Section \u2014 Active Skills Load",
"type": "n8n-nodes-base.stickyNote",
"position": [
528,
144
],
"parameters": {
"color": 6,
"width": 308,
"height": 676,
"content": "## Active Skills Load\nReads all rows from the Skills tab. Code node filters to Active = Yes rows only before passing to the agent."
},
"typeVersion": 1
},
{
"id": "e5e1457f-0d7d-4e26-a75e-b03d7ff2ab94",
"name": "Section \u2014 Skills Format, AI Agent Execution, and Chat Response",
"type": "n8n-nodes-base.stickyNote",
"position": [
944,
208
],
"parameters": {
"color": 6,
"width": 836,
"height": 660,
"content": "## Skills Format, AI Agent Execution, and Chat Response\nCode formats active skills into labeled blocks. GPT-4o-mini matches the user message to the best skill using trigger phrases and follows those instructions exactly. Session Memory maintains context across messages. Respond node returns output to the chat interface."
},
"typeVersion": 1
},
{
"id": "ecdceb25-8e30-49ca-b998-fcc3d1b800a6",
"name": "1. Chat Trigger",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
256,
384
],
"parameters": {
"options": {
"responseMode": "responseNodes"
}
},
"typeVersion": 1.4
},
{
"id": "ea07343c-9746-48ef-b915-af231e13d89a",
"name": "2. Google Sheets \u2014 Load Active Skills",
"type": "n8n-nodes-base.googleSheets",
"position": [
624,
384
],
"parameters": {
"operation": "getAll",
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_SKILLS_SHEET_ID"
}
},
"typeVersion": 4.5
},
{
"id": "c10de66a-62ae-4ea6-815c-57528c3e5789",
"name": "3. Code \u2014 Format Skills for Agent",
"type": "n8n-nodes-base.code",
"position": [
992,
384
],
"parameters": {
"jsCode": "// Filter to Active = Yes rows only and format skills for the AI agent\nconst chatInput = $('1. Chat Trigger').item.json.chatInput || '';\n\n// BUG FIX: filter rows where Active column = 'Yes'\nconst skillRows = $input.all().filter(row => {\n const active = String(row.json['Active'] || '').trim().toLowerCase();\n return active === 'yes';\n});\n\nif (skillRows.length === 0) {\n return [{\n json: {\n chatInput,\n skillsContext: 'No active skills found. Please add skills to the Google Sheet Skills tab and set the Active column to Yes.',\n skillCount: 0,\n skillNames: ''\n }\n }];\n}\n\n// Format each active skill as a clearly labeled block\nconst skillsContext = skillRows.map((row, index) => {\n const skill = row.json;\n return [\n `--- SKILL ${index + 1}: ${skill['Skill Name'] || 'Unnamed'} ---`,\n `Trigger Phrases: ${skill['Trigger Phrases'] || 'not specified'}`,\n `Instructions: ${skill['Instructions'] || 'no instructions provided'}`,\n skill['Example Output'] ? `Example Output: ${skill['Example Output']}` : ''\n ].filter(Boolean).join('\\n');\n}).join('\\n\\n');\n\nreturn [{\n json: {\n chatInput,\n skillsContext,\n skillCount: skillRows.length,\n skillNames: skillRows.map(r => r.json['Skill Name']).filter(Boolean).join(', ')\n }\n}];"
},
"typeVersion": 2
},
{
"id": "5a4e0a53-e475-4e89-852e-09252b900d58",
"name": "4. AI Agent \u2014 Skills Executor",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1232,
384
],
"parameters": {
"text": "={{ $json.chatInput }}",
"options": {
"systemMessage": "=You are a specialized AI assistant. You do NOT use general knowledge to answer questions. You ONLY respond based on the skills and instructions defined below.\n\n## Your Available Skills\n\n{{ $json.skillsContext }}\n\n---\n\n## How to respond\n\n1. Read the user message carefully\n2. Find the skill whose Trigger Phrases best match the user message\n3. Follow that skill's Instructions EXACTLY to generate your response\n4. If the skill has an Example Output, use it as a format reference\n5. If no skill matches the user message, respond with:\n \"I can help you with the following: {{ $json.skillNames }}. Please ask something related to one of these topics.\"\n\n## Rules\n- Never use general knowledge outside of skill instructions\n- Never invent capabilities not listed in the skills\n- Always follow the Instructions field exactly\n- Be helpful and friendly in tone\n- If skill instructions are ambiguous, ask one clarifying question"
},
"promptType": "define"
},
"typeVersion": 3.1
},
{
"id": "ee5dc533-ef57-47d5-94c6-48767691ef8d",
"name": "OpenAI \u2014 GPT-4o-mini Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1232,
576
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {},
"builtInTools": {}
},
"typeVersion": 1.3
},
{
"id": "8b974958-ac90-46ba-8e36-2351b7205879",
"name": "Session Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1344,
752
],
"parameters": {
"sessionKey": "sessionId"
},
"typeVersion": 1.3
},
{
"id": "a4c47e0c-6370-4aaf-ad98-16f313952661",
"name": "5. Respond to Chat",
"type": "@n8n/n8n-nodes-langchain.chat",
"position": [
1648,
384
],
"parameters": {
"message": "={{ $json.output }}",
"options": {}
},
"typeVersion": 1.3
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"executionOrder": "v1"
},
"versionId": "3daf7d88-766b-4c28-8e3d-43d7311c245d",
"connections": {
"Session Memory": {
"ai_memory": [
[
{
"node": "4. AI Agent \u2014 Skills Executor",
"type": "ai_memory",
"index": 0
}
]
]
},
"1. Chat Trigger": {
"main": [
[
{
"node": "2. Google Sheets \u2014 Load Active Skills",
"type": "main",
"index": 0
}
]
]
},
"OpenAI \u2014 GPT-4o-mini Model": {
"ai_languageModel": [
[
{
"node": "4. AI Agent \u2014 Skills Executor",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"4. AI Agent \u2014 Skills Executor": {
"main": [
[
{
"node": "5. Respond to Chat",
"type": "main",
"index": 0
}
]
]
},
"3. Code \u2014 Format Skills for Agent": {
"main": [
[
{
"node": "4. AI Agent \u2014 Skills Executor",
"type": "main",
"index": 0
}
]
]
},
"2. Google Sheets \u2014 Load Active Skills": {
"main": [
[
{
"node": "3. Code \u2014 Format Skills for Agent",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow creates a session-based chatbot in n8n Chat that loads “skills” from Google Sheets and uses OpenAI GPT-4o-mini to respond strictly according to the matched skill’s trigger phrases and instructions. Receives each message from the built-in n8n Chat trigger. Retrieves…
Source: https://n8n.io/workflows/16117/ — 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.
Who is this workflow for? This workflow is designed for SEO analysts, content creators, marketing agencies, and developers who need to index a website and then interact with its content as if it were
This workflow creates a fully interactive AI-powered Sales CRM Chatbot inside n8n, capable of understanding user queries, searching Google Sheets for CRM data, and responding intelligently based on re
Let your team create, track, and manage project tasks through natural conversation. This workflow uses an AI Project Manager Agent that chats with users, gathers the task details it needs, and automat
HDW Lead Geländewagen. Uses chatTrigger, lmChatOpenAi, memoryBufferWindow, outputParserStructured. Chat trigger; 92 nodes.
This Chatbot automates the process of discovering job openings and generating tailored job application emails.