This workflow corresponds to n8n.io template #8779 — we link there as the canonical source.
This workflow follows the Chainllm → Gmail 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 →
{
"nodes": [
{
"id": "e4901bb9-08e4-4312-be91-c0e73cc8f563",
"name": "Support Answer Found",
"type": "n8n-nodes-base.if",
"position": [
-672,
-80
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f852c674-481e-4732-8eee-93e2fc1e37cc",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.answerFound }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "c0df0cb1-4d45-4d48-b008-f2da5d0b54c0",
"name": "Is it a Support Request?",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
-2144,
-80
],
"parameters": {
"options": {},
"inputText": "=Subject: {{ $('On New Email Received').item.json.text }}\n\nContent:\n{{ $('On New Email Received').item.json.text }}",
"categories": {
"categories": [
{
"category": "support",
"description": "Questions asking for support"
},
{
"category": "other",
"description": "Promotions, services, and other emails"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "7c4f23a6-e3b1-44e6-a9d1-f8a62360c613",
"name": "Combine into Knowledge Context",
"type": "n8n-nodes-base.aggregate",
"position": [
-1504,
-80
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "e060cb71-e63b-4f61-aabb-c196b042d050",
"name": "AI: Create Reusable Q&A",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
-32,
64
],
"parameters": {
"text": "=<instructions>\n<goal>\nYour goal is to take an original customer question and the corresponding answer provided by a human expert, and transform them into a standardized, generic, and reusable Question/Answer pair. This new entry must be suitable for an automated system to use for future, similar inquiries.\n</goal>\n\n<context>\nThis task is part of a 'human-in-the-loop' automated customer support workflow. When the system cannot answer a customer's email using its existing knowledge base (a Google Sheet), the question is forwarded to a human expert. You are now receiving the original question and the expert's reply.\n\nYour generated Q&A pair will be added as a new row to the Google Sheet knowledge base. This will allow the system to answer this question automatically next time.\n\nKey principles to follow:\n1. **Generalize the Question:** Rephrase the customer's question to be generic and universally applicable. Remove any personal information (names, specific order numbers, account details, etc.) and formulate it as a general query that other customers might ask.\n2. **Refine the Answer:** Clean up the expert's reply. It should be a complete, well-formatted, and polite response that is ready to be sent directly to a customer without further editing. Remove conversational filler like \"Hi John,\" or \"Hope this helps!\".\n3. **Capture the Essence:** The final Q&A pair should accurately represent the core problem and its solution.\n</context>\n\n<examples>\n<example_1>\n<inputs>\n<customer_question>\nHi, my name is Jane Doe and I ordered a blue widget last Tuesday (order #12345). I haven't received a shipping confirmation yet. Can you tell me how long shipping usually takes to California? Thanks, Jane\n</customer_question>\n<expert_answer>\nHey Jane, I checked your order. It's currently being processed. For future reference, our standard shipping to the US West Coast is typically 5-7 business days. Cheers.\n</expert_answer>\n</inputs>\n<output>\n{\n \"question\": \"What are the standard shipping times to the US West Coast?\",\n \"answer\": \"Standard shipping to the US West Coast typically takes 5-7 business days after your order has been processed. You will receive a shipping confirmation email with a tracking number as soon as your order is dispatched.\"\n}\n</output>\n</example_1>\n\n<example_2>\n<inputs>\n<customer_question>\nI can't find where to reset my API key on my dashboard. I looked in the settings but it's not there. Help!\n</customer_question>\n<expert_answer>\nNo problem. To do that, you need to go to the 'Developer' section, not 'Settings'. From there, you'll see a 'Revoke Key' button. Click that and a new one will be generated for you.\n</expert_answer>\n</inputs>\n<output>\n{\n \"question\": \"How do I reset my API key?\",\n \"answer\": \"You can reset your API key by following these steps:\\n1. Log in to your account and navigate to the 'Developer' section in your dashboard.\\n2. Click on the 'Revoke Key' button.\\n3. A new API key will be automatically generated for you.\"\n}\n</output>\n</example_2>\n\n<example_3>\n<inputs>\n<customer_question>\nmy bill is higher this month?? i dont understand why\n</customer_question>\n<expert_answer>\nHi, we recently updated our pricing for the Pro plan from $49/month to $55/month to reflect new features we've added. We sent out an email about this last month. This is the first billing cycle with the new price.\n</expert_answer>\n</inputs>\n<output>\n{\n \"question\": \"Why did my monthly subscription price increase?\",\n \"answer\": \"We recently updated our pricing to reflect the addition of new features to our plans. If you have noticed an increase in your monthly bill, it is likely due to this planned pricing adjustment. All users were notified via email prior to the change.\"\n}\n</output>\n</example_3>\n</examples>\n\n\n<output_format>\nYou must provide your response as a single, valid JSON object. The object should contain two keys: \"question\" and \"answer\". Do not include any other text, explanations, or markdown formatting around the JSON object.\n\n{\n \"question\": \"The generated generic question.\",\n \"answer\": \"The clean, customer-ready answer.\"\n}\n</output_format>\n</instructions>\n\n<inputs>\n<customer_question>\n{{ $('On New Email Received').last().json.text }}\n</customer_question>\n<expert_answer>\n{{ $('Ask Human for Help').last().json.data.text }}\n</expert_answer>\n</inputs>",
"batching": {},
"messages": {
"messageValues": [
{
"message": "=You are an expert AI assistant specialized in knowledge base management. Your task is to distill human conversations into clean, reusable question-and-answer pairs for an automated support system. You must transform a specific customer query and an expert's ad-hoc reply into a generic, canonical entry that can be used to help many other users in the future."
}
]
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.7
},
{
"id": "038bc2f0-0f96-4bff-9831-ef1a4b2e91e8",
"name": "On New Email Received",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-2368,
-80
],
"parameters": {
"simple": false,
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "be228b52-d891-481d-a3e9-1ac995321f0d",
"name": " Send AI Answer",
"type": "n8n-nodes-base.gmail",
"position": [
-368,
-224
],
"parameters": {
"sendTo": "={{ $('On New Email Received').last().json.from.value[0].address }}",
"message": "={{ $json.output.responseEmailHtml }}",
"options": {
"appendAttribution": false
},
"subject": "=Re: {{ $('On New Email Received').last().json.subject }}"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "a5a7d86b-4567-43d8-aa69-ba3b3a7b831c",
"name": "Ask Human for Help",
"type": "n8n-nodes-base.gmail",
"position": [
-368,
64
],
"parameters": {
"message": "=Hello,\n\nOur automated support system has received a question for which we don't yet have an answer in our knowledge base.\n\n**ORIGINAL CUSTOMER QUESTION:** {{ $('Find Answer with AI').last().json.output.summarizedQuestion }}\n---\nFrom: {{ $('On New Email Received').item.json.from.value[0].address }}\nSubject: {{ $('On New Email Received').item.json.subject }}\n\n{{ $('On New Email Received').item.json.text }}\n---\n\n**ACTION REQUIRED:**\nPlease reply to this email with:\n1. The complete answer to provide to the customer\n2. Any additional information that might be useful for similar questions\n\nYour response will automatically be:\n- Sent to the customer ({{ $('On New Email Received').item.json.from.value[0].address }})\n- Added to our knowledge base for future similar questions\n\nBest regards,\nAutomated Support System",
"options": {
"responseFormTitle": "New Support Question",
"messageButtonLabel": "Submit Answer",
"responseFormDescription": "=QUESTION: {{ $('Parsed AI Response').last().json.summarizedQuestion }}\n\nCUSTOMER DETAILS:\nFrom: {{ $('On New Email Received').item.json.from.value[0].address }}\nSubject: {{ $('On New Email Received').item.json.subject }}\n\nORIGINAL MESSAGE:\n{{ $('On New Email Received').item.json.text }}\n\n---\n\nPlease provide your complete response below. Your answer will be automatically sent to the customer and added to our knowledge base for future similar questions."
},
"subject": "[AUTO SUPPORT] New question requiring your expertise",
"operation": "sendAndWait",
"responseType": "freeText"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "b1da195b-0232-438f-a516-5006b2c5e872",
"name": "Add to Knowledge Base",
"type": "n8n-nodes-base.googleSheets",
"position": [
368,
64
],
"parameters": {
"columns": {
"value": {
"Answer": "={{ $json.output.answer }}",
"Question": "={{ $json.output.question }}"
},
"schema": [
{
"id": "Question",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Question",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Answer",
"type": "string",
"display": true,
"required": false,
"displayName": "Answer",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Question"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE/edit#gid=0",
"cachedResultName": "QA Database"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE/edit?usp=drivesdk",
"cachedResultName": "Knowledge Base"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "930fd9c5-7601-4dbc-88ed-a15b77605588",
"name": "Get Knowledge Base",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1744,
-80
],
"parameters": {
"sheetName": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultUrl": "",
"cachedResultName": ""
},
"documentId": {
"__rl": true,
"mode": "list",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "598ea1ca-f3c7-44ec-84d9-68eaab365ca7",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-784,
-336
],
"parameters": {
"color": 5,
"width": 336,
"height": 304,
"content": "### How it Works\n\n**\u2705 If an answer is found:**\nThe AI sends the reply directly.\n\n**\u2753 If no answer is found:**\n1. An email is sent to a human expert.\n2. The expert's reply is used to create a new Q&A.\n3. The knowledge base is updated for future responses."
},
"typeVersion": 1
},
{
"id": "b681744b-3571-4999-bda1-f92590bd7d9c",
"name": "Find Answer with AI",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
-1280,
-80
],
"parameters": {
"text": "=<instructions>\n<goal>\nYour goal is to analyze the customer's email and compare it against the entire knowledge base. Based on your analysis, you will perform one of two actions:\n1. **If a highly relevant answer is found:** You will draft a complete, polite, and helpful email response in HTML format.\n2. **If no relevant answer is found (or if you have low confidence):** You will summarize the customer's core question into a concise sentence for escalation to a human expert. It is better to escalate than to provide a wrong answer.\n</goal>\n\n<context>\n- The knowledge base is a list of pre-existing \"Question\" and \"Answer\" pairs.\n- You must evaluate the semantic meaning of the customer's question, not just keyword matching.\n- The customer's email might contain greetings, signatures, and other non-essential text. You must focus on the actual question or problem.\n- Your output will be parsed by a machine, so it must strictly follow the specified JSON format.\n- If you find an answer, the `response_email_html` should be a complete email, ready to be sent, including a polite greeting and closing.\n</context>\n\n<examples>\n<example_1>\n<inputs>\n<customer_email_body>\nHello,\n\nI can't seem to find where I can reset my password on your platform. Can you help me?\n\nThanks,\nJohn Doe\n</customer_email_body>\n<knowledge_base>\n[\n {\"Question\": \"How to update my billing information?\", \"Answer\": \"You can update your billing information in the 'Account > Billing' section of your dashboard.\"},\n {\"Question\": \"How do I reset my password?\", \"Answer\": \"To reset your password, please go to the login page and click the 'Forgot Password?' link. You will receive an email with instructions.\"},\n {\"Question\": \"What are your opening hours?\", \"Answer\": \"Our support team is available from 9 AM to 5 PM, Monday to Friday.\"}\n]\n</knowledge_base>\n</inputs>\n<output>\n{\n \"answerFound\": true,\n \"responseEmailHtml\": \"<html><body><p>Hello,</p><p>Thank you for contacting us.</p><p>To reset your password, please go to the login page and click the 'Forgot Password?' link. You will receive an email with instructions to set a new one.</p><p>If you need further assistance, please let us know.</p><p>Best regards,<br>The Support Team</p></body></html>\",\n \"summarizedQuestion\": null\n}\n</output>\n</example_1>\n\n<example_2>\n<inputs>\n<customer_email_body>\nHi there,\n\nMy latest invoice (INV-2023-12-45) seems to have a calculation error on the VAT for the 'Pro Plan' line item. It's showing 20% but my company is VAT exempt. Can you check this?\n\nBest,\nJane Smith\n</customer_email_body>\n<knowledge_base>\n[\n {\"Question\": \"How to update my billing information?\", \"Answer\": \"You can update your billing information in the 'Account > Billing' section of your dashboard.\"},\n {\"Question\": \"Where can I find my invoices?\", \"Answer\": \"All your past invoices are available for download in the 'Account > Billing > Invoices' section.\"},\n {\"Question\": \"How do I reset my password?\", \"Answer\": \"To reset your password, please go to the login page and click the 'Forgot Password?' link.\"}\n]\n</knowledge_base>\n</inputs>\n<output>\n{\n \"answerFound\": false,\n \"responseEmailHtml\": null,\n \"summarizedQuestion\": \"Customer is reporting a specific VAT calculation error on their latest invoice.\"\n}\n</output>\n</example_2>\n</examples>\n\n\n<output_format>\nYou MUST provide your response as a single, valid JSON object. Do not add any text before or after the JSON object. The JSON object must have the following structure:\n\n```json\n{\n \"answerFound\": <boolean>,\n \"responseEmailHtml\": <string | null>,\n \"summarizedQuestion\": <string | null>\n}\n```\n\n- `answerFound`: (boolean) Set to `true` ONLY if you found a highly relevant answer in the knowledge base with high confidence. Otherwise, set to `false`.\n- `responseEmailHtml`: (string or null) If `answer_found` is `true`, this field must contain the full HTML content of the email to be sent to the customer. If `answer_found` is `false`, this field must be `null`.\n- `summarizedQuestion`: (string or null) If `answer_found` is `false`, this field must contain a concise, one-sentence summary of the customer's problem for a human expert. If `answer_found` is `true`, this field must be `null`.\n</output_format>\n</instructions>\n\n\n<inputs>\n<customer_email_body>\n{{ $('On New Email Received').item.json.text }}\n</customer_email_body>\n<knowledge_base>\n{{ $('Combine into Knowledge Context').last().json.data.toJsonString() }}\n</knowledge_base>\n</inputs>",
"batching": {},
"messages": {
"messageValues": [
{
"message": "=You are an expert AI Customer Support Agent. Your specialty is to analyze incoming customer inquiries and determine with high confidence if they can be answered using a provided knowledge base. You are a critical part of an automated workflow that decides whether to send an automated reply or escalate the issue to a human expert."
}
]
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "1b9f2c45-f15a-4331-9ebd-c6c2325d5226",
"name": "Sticky Note (0)",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3136,
-144
],
"parameters": {
"color": 0,
"width": 480,
"height": 600,
"content": "## \ud83e\udd16 Self Improving Email AI Support\n\nThis workflow answers emails using a Google Sheet as a knowledge base.\n\nIf it doesn't know the answer, it asks a human and **learns the new reply automatically**.\n\n### To get started:\n1. **Connect your credentials** for Gmail, Google Sheets, and Google Gemini (see red sticky notes).\n2. **Set up your Google Sheet** knowledge base (see red sticky note).\n3. **Customize the expert email** address in the `Ask Human for Help` node (see purple sticky note).\n4. **Activate** the workflow to start processing emails.\n\n---\n\n### Automate your operations today\nYour time is valuable. Let us automate the boring stuff for you.\n\n**\ud83d\udc47 CHOOSE YOUR PATH:**\n\n[ **\u26a1\ufe0f I WANT A FREE AUDIT (2 min)** ](https://workflows.ac/audit?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=self_improving_email_ai_support_with_human_in_the_loop&utm_content=8779)\n> *We've put our heart into this business evaluation machine.*\n\n[ **\ud83d\udca1 I HAVE A SPECIFIC REQUEST** ](https://workflows.ac/form?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=self_improving_email_ai_support_with_human_in_the_loop&utm_content=8779)\n"
},
"typeVersion": 1
},
{
"id": "cdd8f3df-5421-479f-a3fc-c4c937209b46",
"name": "Sticky Note (3)",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2144,
0
],
"parameters": {
"color": "3",
"width": 224,
"height": 508,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis workflow uses Google Gemini models for AI tasks.\n\n1. **[Go to Google AI Studio](https://aistudio.google.com/app/apikey)**\n2. Click **\u201cCreate API key in new project\u201d** and copy it.\n\n3. Open the ```Google Gemini 2.5 Pro``` node:\n * **Select Credential \u2192 Create New**\n * Paste into **API Key** and **Save**\n\n"
},
"typeVersion": 1
},
{
"id": "0d85f239-3c58-442b-8214-341e69c8c3f9",
"name": "Sticky Note (4)",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1744,
-320
],
"parameters": {
"color": 3,
"width": 334,
"height": 286,
"content": "This workflow uses a Google Sheet as its knowledge base.\n\n1. **Create a new Google Sheet** in your Google Drive called `Knowledge Base`.\n2. Name the first sheet `QA Database`.\n3. Add two column headers: `Question` and `Answer`.\n4. **Open the `Get Knowledge Base` node** and select your newly created spreadsheet."
},
"typeVersion": 1
},
{
"id": "9a43057d-44a3-48ea-9bef-35549006f365",
"name": "Sticky Note (5)",
"type": "n8n-nodes-base.stickyNote",
"position": [
-368,
-32
],
"parameters": {
"color": "6",
"width": 300,
"height": 138,
"content": "Set the **To** email address for your human expert. This is where questions the AI can't answer will be forwarded."
},
"typeVersion": 1
},
{
"id": "3da661f7-886e-414e-baa6-0a3d7c7ebac7",
"name": "Sticky Note (6)",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1280,
-272
],
"parameters": {
"color": "7",
"width": 222,
"height": 252,
"content": "This is the core AI that attempts to find an answer in your knowledge base.\n\n**Open this node** and adapt the `prompt` to best suit your support context and the type of questions you expect.\n\n\n\n\n\n\n\n\n\n\n"
},
"typeVersion": 1
},
{
"id": "ef38413d-2c41-4654-9fea-3b0ba79becb8",
"name": "Sticky Note (7)",
"type": "n8n-nodes-base.stickyNote",
"position": [
-32,
-64
],
"parameters": {
"color": 7,
"width": 366,
"height": 172,
"content": "This AI node is the 'learning' component.\n\nAfter a human expert replies, this AI processes their answer and the original question to create a new, reusable Q&A pair for your knowledge base."
},
"typeVersion": 1
},
{
"id": "fb646660-1854-42bf-96a8-5cadabbdeb0d",
"name": "Sticky Note (9)",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2144,
-208
],
"parameters": {
"color": "7",
"width": 220,
"height": 168,
"content": "This node uses AI to classify incoming emails, ensuring only relevant support requests proceed through the workflow.\n\n\n\n\n\n\n\n\n\n\n\n"
},
"typeVersion": 1
},
{
"id": "d7513dd8-2136-4ea3-a1b3-9b547b1069f4",
"name": "Sticky Note (10)",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2576,
-144
],
"parameters": {
"color": "7",
"width": 300,
"height": 136,
"content": "\ud83d\udca1 Once configured, activate this workflow to start automatically processing incoming emails!"
},
"typeVersion": 1
},
{
"id": "2f5d1f07-fc15-4a7b-aac9-5c10d8c07913",
"name": "Sticky Note (11)",
"type": "n8n-nodes-base.stickyNote",
"position": [
368,
-64
],
"parameters": {
"color": 7,
"width": 300,
"height": 184,
"content": "Check your Google Sheet!\n\nNew Q&A pairs generated by the AI (from human expert replies) will be added here."
},
"typeVersion": 1
},
{
"id": "07018c4e-7f40-4de4-8277-0c49a90d712c",
"name": "Parsed AI Response",
"type": "n8n-nodes-base.set",
"position": [
-928,
-80
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={{ $json.text.replace(/^```json\\s*|\\s*```$/g, '') }}"
},
"typeVersion": 3.4
},
{
"id": "e70bad34-7e23-4eb9-9bf2-65a1caec85aa",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
128,
256
],
"parameters": {
"jsonSchemaExample": "{\n \"question\": \"The generated generic question.\",\n \"answer\": \"The clean, customer-ready answer.\"\n}"
},
"typeVersion": 1.3
},
{
"id": "05ae50cd-2b0b-4edc-96b4-56ff900ea105",
"name": "Gemini Flash Lite Latest",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-2080,
64
],
"parameters": {
"options": {
"temperature": 0
},
"modelName": "models/gemini-flash-lite-latest"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "b27cf69f-ea3b-412f-8d38-53a48930c76e",
"name": "Gemini Flash Latest",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-1200,
64
],
"parameters": {
"options": {
"temperature": 0
},
"modelName": "models/gemini-flash-latest"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "e4fac013-1b3a-4f6d-80b6-09fb74cf9684",
"name": "Gemini Flash Latest (1)",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-48,
256
],
"parameters": {
"options": {
"temperature": 0
},
"modelName": "models/gemini-flash-latest"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "38a0c40a-710d-4571-9ff2-8775c4dc7d46",
"name": "Start Again (with Saved Answer)",
"type": "n8n-nodes-base.noOp",
"position": [
608,
272
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c7a4b76d-a859-4cb3-9a88-6e759ac6fa50",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
-608
],
"parameters": {
"color": 7,
"width": 416,
"height": 1072,
"content": "---\n\n## Was this helpful? Let me know!\n[](https://api.ia2s.app/form/templates/academy)\n\nI really hope this template helped you. Your feedback is what helps me create better resources for the n8n community.\n\n### **Have Feedback, a Question, or a Project Idea?**\n\n\n#### \u27a1\ufe0f **[Click here to go to the Contact Form](https://workflows.ac/form?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=self_improving_email_ai_support_with_human_in_the_loop&utm_content=8779)**\n\nUse this single link for anything you need:\n\n* **Give Feedback:** Share your thoughts on this template, whether you found a typo, encountered an unexpected error, have a suggestion, or just want to say thanks!\n\n* **Automation Coaching:** Get personalized, one-on-one guidance to master n8n. We can work together to help you reach an expert level.\n\n* **Automation Consulting:** Have a complex business challenge or need custom workflows built from scratch? We offer a plug and play automation department for 8 to 88 people teams with unlimited automation requests.\n\n---\n\nHappy Automating!\nLucas Peyrin | [Workflows Accelerator](https://workflows.ac?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=self_improving_email_ai_support_with_human_in_the_loop&utm_content=8779)"
},
"typeVersion": 1
}
],
"connections": {
"Ask Human for Help": {
"main": [
[
{
"node": "AI: Create Reusable Q&A",
"type": "main",
"index": 0
}
]
]
},
"Get Knowledge Base": {
"main": [
[
{
"node": "Combine into Knowledge Context",
"type": "main",
"index": 0
}
]
]
},
"Parsed AI Response": {
"main": [
[
{
"node": "Support Answer Found",
"type": "main",
"index": 0
}
]
]
},
"Find Answer with AI": {
"main": [
[
{
"node": "Parsed AI Response",
"type": "main",
"index": 0
}
]
]
},
"Gemini Flash Latest": {
"ai_languageModel": [
[
{
"node": "Find Answer with AI",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Support Answer Found": {
"main": [
[
{
"node": " Send AI Answer",
"type": "main",
"index": 0
}
],
[
{
"node": "Ask Human for Help",
"type": "main",
"index": 0
}
]
]
},
"Add to Knowledge Base": {
"main": [
[
{
"node": "Start Again (with Saved Answer)",
"type": "main",
"index": 0
}
]
]
},
"On New Email Received": {
"main": [
[
{
"node": "Is it a Support Request?",
"type": "main",
"index": 0
}
]
]
},
"AI: Create Reusable Q&A": {
"main": [
[
{
"node": "Add to Knowledge Base",
"type": "main",
"index": 0
}
]
]
},
"Gemini Flash Latest (1)": {
"ai_languageModel": [
[
{
"node": "AI: Create Reusable Q&A",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Gemini Flash Lite Latest": {
"ai_languageModel": [
[
{
"node": "Is it a Support Request?",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Is it a Support Request?": {
"main": [
[
{
"node": "Get Knowledge Base",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI: Create Reusable Q&A",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Combine into Knowledge Context": {
"main": [
[
{
"node": "Find Answer with AI",
"type": "main",
"index": 0
}
]
]
},
"Start Again (with Saved Answer)": {
"main": [
[
{
"node": "Get Knowledge Base",
"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.
gmailOAuth2googlePalmApigoogleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow creates a sophisticated, self-improving customer support system that automatically handles incoming emails. It's designed to answer common questions using an AI-powered knowledge base and, crucially, to learn from human experts when new or complex questions arise,…
Source: https://n8n.io/workflows/8779/ — 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.
Perfect for use cases such as: 💼 Finance teams managing vendor invoices 📊 Bookkeeping workflows 🔄 Automating monthly reconciliation
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
Automate your lead intake, scoring, and outreach pipeline. This workflow collects leads from forms, enriches and scores them using Relevance AI, routes them by quality, and triggers the right follow-u
AI Agents Vs AI Workflow. Uses lmChatOpenAi, gmailTrigger, gmail, gmailTool. Event-driven trigger; 30 nodes.
Use cases are many: Manage your Gmail inbox, schedule calendar events, and handle contact details — all from one central AI-powered assistant. Perfect for freelancers managing clients, agency owners w