{
  "name": "🤖 Self Improving Email AI Support with Human-in-the-Loop",
  "nodes": [
    {
      "id": "e4901bb9-08e4-4312-be91-c0e73cc8f563",
      "name": "Support Answer Found",
      "type": "n8n-nodes-base.if",
      "position": [
        -672,
        -80
      ]
    },
    {
      "id": "c0df0cb1-4d45-4d48-b008-f2da5d0b54c0",
      "name": "Is it a Support Request?",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        -2144,
        -80
      ]
    },
    {
      "id": "7c4f23a6-e3b1-44e6-a9d1-f8a62360c613",
      "name": "Combine into Knowledge Context",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -1504,
        -80
      ]
    },
    {
      "id": "e060cb71-e63b-4f61-aabb-c196b042d050",
      "name": "AI: Create Reusable Q&A",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -32,
        64
      ]
    },
    {
      "id": "038bc2f0-0f96-4bff-9831-ef1a4b2e91e8",
      "name": "On New Email Received",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -2368,
        -80
      ]
    },
    {
      "id": "be228b52-d891-481d-a3e9-1ac995321f0d",
      "name": " Send AI Answer",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -368,
        -224
      ]
    },
    {
      "id": "a5a7d86b-4567-43d8-aa69-ba3b3a7b831c",
      "name": "Ask Human for Help",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -368,
        64
      ]
    },
    {
      "id": "b1da195b-0232-438f-a516-5006b2c5e872",
      "name": "Add to Knowledge Base",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        368,
        64
      ]
    },
    {
      "id": "930fd9c5-7601-4dbc-88ed-a15b77605588",
      "name": "Get Knowledge Base",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1744,
        -80
      ]
    },
    {
      "id": "598ea1ca-f3c7-44ec-84d9-68eaab365ca7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -336
      ],
      "parameters": {
        "width": 336,
        "height": 304,
        "content": "### How it Works\n\n**✅ If an answer is found:**\nThe AI sends the reply directly.\n\n**❓ 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"
      }
    },
    {
      "id": "b681744b-3571-4999-bda1-f92590bd7d9c",
      "name": "Find Answer with AI",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1280,
        -80
      ]
    },
    {
      "id": "1b9f2c45-f15a-4331-9ebd-c6c2325d5226",
      "name": "Sticky Note (0)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3136,
        -144
      ],
      "parameters": {
        "width": 480,
        "height": 600,
        "content": "## 🤖 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**."
      }
    },
    {
      "id": "cdd8f3df-5421-479f-a3fc-c4c937209b46",
      "name": "Sticky Note (3)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2144,
        0
      ],
      "parameters": {
        "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 **“Create API key in new project”** and copy "
      }
    },
    {
      "id": "0d85f239-3c58-442b-8214-341e69c8c3f9",
      "name": "Sticky Note (4)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        -320
      ],
      "parameters": {
        "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 hea"
      }
    },
    {
      "id": "9a43057d-44a3-48ea-9bef-35549006f365",
      "name": "Sticky Note (5)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        -32
      ],
      "parameters": {
        "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."
      }
    },
    {
      "id": "3da661f7-886e-414e-baa6-0a3d7c7ebac7",
      "name": "Sticky Note (6)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        -272
      ],
      "parameters": {
        "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"
      }
    },
    {
      "id": "ef38413d-2c41-4654-9fea-3b0ba79becb8",
      "name": "Sticky Note (7)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -64
      ],
      "parameters": {
        "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."
      }
    },
    {
      "id": "fb646660-1854-42bf-96a8-5cadabbdeb0d",
      "name": "Sticky Note (9)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2144,
        -208
      ],
      "parameters": {
        "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"
      }
    },
    {
      "id": "d7513dd8-2136-4ea3-a1b3-9b547b1069f4",
      "name": "Sticky Note (10)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2576,
        -144
      ],
      "parameters": {
        "width": 300,
        "height": 136,
        "content": "💡 Once configured, activate this workflow to start automatically processing incoming emails!"
      }
    },
    {
      "id": "2f5d1f07-fc15-4a7b-aac9-5c10d8c07913",
      "name": "Sticky Note (11)",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        -64
      ],
      "parameters": {
        "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."
      }
    },
    {
      "id": "07018c4e-7f40-4de4-8277-0c49a90d712c",
      "name": "Parsed AI Response",
      "type": "n8n-nodes-base.set",
      "position": [
        -928,
        -80
      ]
    },
    {
      "id": "e70bad34-7e23-4eb9-9bf2-65a1caec85aa",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        128,
        256
      ]
    },
    {
      "id": "05ae50cd-2b0b-4edc-96b4-56ff900ea105",
      "name": "Gemini Flash Lite Latest",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -2080,
        64
      ]
    },
    {
      "id": "b27cf69f-ea3b-412f-8d38-53a48930c76e",
      "name": "Gemini Flash Latest",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1200,
        64
      ]
    },
    {
      "id": "e4fac013-1b3a-4f6d-80b6-09fb74cf9684",
      "name": "Gemini Flash Latest (1)",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -48,
        256
      ]
    },
    {
      "id": "38a0c40a-710d-4571-9ff2-8775c4dc7d46",
      "name": "Start Again (with Saved Answer)",
      "type": "n8n-nodes-base.noOp",
      "position": [
        608,
        272
      ]
    },
    {
      "id": "c7a4b76d-a859-4cb3-9a88-6e759ac6fa50",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -608
      ],
      "parameters": {
        "width": 416,
        "height": 1072,
        "content": "---\n\n## Was this helpful? Let me know!\n[![clic](https://supastudio.ia2s.app/storage/v1/object/public/assets/n8n/clic_down_lucas.gif)](https://api.ia2s.app/form/templates/academy)\n\nI really hope this t"
      }
    }
  ],
  "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
          }
        ]
      ]
    }
  }
}