{
  "id": "Dxfmbt0hbIr6GN01",
  "name": "Customer_Support_Agent",
  "tags": [],
  "nodes": [
    {
      "id": "be23e9c7-5b61-4578-940d-7d992594009f",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        576,
        304
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "00a8bbd7-f686-4418-bead-094ceeaa5b17",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        784,
        464
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "typeVersion": 1
    },
    {
      "id": "d380d68c-e23f-4f04-82a4-4afe389c4e59",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1088,
        416
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4e326e15-1ecd-4f76-8eaf-6f2648f314c9",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1280,
        528
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "17f862f3-057b-4066-896a-a2017a5859ed",
      "name": "Notify Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        1904,
        240
      ],
      "parameters": {
        "text": "Response to query sent",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "select": "user",
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "id": "3f259a9a-809f-43d1-bcce-2453df7f7028",
      "name": "Reply to Query",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1904,
        16
      ],
      "parameters": {
        "message": "={{ $('Email Support Agent').item.json.output }}",
        "options": {},
        "emailType": "text",
        "messageId": "={{ $json.id }}",
        "operation": "reply"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ec4d6090-b2c1-4b58-8fba-35177199ecf0",
      "name": "Label Query",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1680,
        128
      ],
      "parameters": {
        "labelIds": [
          "Label_86712+1234567890"
        ],
        "messageId": "={{ $('Intent Classifier').item.json.id }}",
        "operation": "addLabels"
      },
      "typeVersion": 2.1
    },
    {
      "id": "470a6a6b-7f9d-47c2-92b2-d36a040eb185",
      "name": "Email Support Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1248,
        112
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are an expert Customer support Agent your job is to reply to customer message. Use ppincone vector tool to get data from knowledge base to answer to relevant question of Customer\n## Output\noutput must be body of email it does not include subject\nit is replying to an email not writing an email"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "0fb47262-525e-40d6-8505-8cb3ba17af9b",
      "name": "Intent Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        768,
        304
      ],
      "parameters": {
        "options": {},
        "inputText": "={{ $json.text }}",
        "categories": {
          "categories": [
            {
              "category": "Customer Support",
              "description": "Any email that is related to helping cutomer . it may contains a question , query etc "
            },
            {
              "category": "Other",
              "description": "email other than Customer support"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "1e327de4-9bd8-46b3-901f-e02abbc89ee2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        32
      ],
      "parameters": {
        "width": 464,
        "height": 464,
        "content": "## Gmail AI Support Automation\n\n## How it works\nThis workflow turns your Gmail inbox into an AI-powered support assistant. When a new email arrives, it\u2019s classified by intent using Google Gemini. If it\u2019s a support request, the Email Support Agent uses OpenAI embeddings and Pinecone to craft a context-aware reply. The workflow then labels the conversation, sends the reply via Gmail, and notifies your team in Slack.\n## Setup steps\n1.  Connect Gmail \u2192 authenticate your account.\n2. Add API keys for Google Gemini and OpenAI.\n3. Connect Pinecone, then create or select an index.\n4. (Optional) Integrate Slack for team alerts.\n5. Adjust response tone in the Email Support Agent node.\n\n\nTest by sending a sample email  the AI reply, Gmail label, and Slack alert confirm setup."
      },
      "typeVersion": 1
    },
    {
      "id": "814e7a7c-81ea-4675-a4e4-6e8c0c75b40b",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        1360,
        336
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "new",
          "cachedResultName": "new"
        },
        "toolDescription": "Use this tool when you need to answer customer query "
      },
      "typeVersion": 1.3
    },
    {
      "id": "0f2da3bd-9b62-4b84-b318-618ebd99dda7",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 352,
        "content": "## Gmail Intake"
      },
      "typeVersion": 1
    },
    {
      "id": "93e9dc0c-fedc-4947-9416-c70b5de1b170",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        64
      ],
      "parameters": {
        "color": 4,
        "width": 304,
        "height": 176,
        "content": "## AI Response Engine"
      },
      "typeVersion": 1
    },
    {
      "id": "43c00e83-c9f4-4553-8931-6e8902ed95cf",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1648,
        -48
      ],
      "parameters": {
        "color": 6,
        "width": 480,
        "height": 448,
        "content": "## Actions & Notifications"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "46cbae47-265f-4bb6-822c-c9e542d40e0f",
  "connections": {
    "Label Query": {
      "main": [
        [
          {
            "node": "Reply to Query",
            "type": "main",
            "index": 0
          },
          {
            "node": "Notify Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Intent Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Intent Classifier": {
      "main": [
        [
          {
            "node": "Email Support Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Support Agent": {
      "main": [
        [
          {
            "node": "Label Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_tool": [
        [
          {
            "node": "Email Support Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Intent Classifier",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Email Support Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}