{
  "name": "✉️ Automated email sorting & drafting for customer support - with AI 🤖",
  "nodes": [
    {
      "id": "0b5bdfa6-7936-43ea-945e-d55800babadd",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -80,
        425
      ]
    },
    {
      "id": "7fc2981f-8c95-4039-a218-a0a172d454a4",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        360,
        425
      ]
    },
    {
      "id": "37e7aa8c-b3c8-406b-9632-9c3be0d59c23",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        820,
        220
      ]
    },
    {
      "id": "a5496f41-7220-4c27-913f-4e228d44697f",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        960,
        220
      ]
    },
    {
      "id": "73c52d4d-7827-4fc9-ba59-9d2a1c5d7175",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        -40
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "4caf014c-cf0b-49bc-a540-d16d3e566c37",
      "name": "Schedule Trigger1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -100,
        800
      ]
    },
    {
      "id": "a6e6dfe3-12e3-4020-9cff-da2234110ad0",
      "name": "Loop Over Items1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        360,
        800
      ]
    },
    {
      "id": "29a8a8ae-030f-456b-b90f-1edb7a1aa3bf",
      "name": "Markdown1",
      "type": "n8n-nodes-base.markdown",
      "position": [
        580,
        820
      ]
    },
    {
      "id": "2d74434d-07c2-487a-a941-04f6a9b5de83",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        820,
        980
      ]
    },
    {
      "id": "ba54d0ff-5972-4059-8e15-247f2bbe0cb7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        700
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "a742b80f-5aaf-4dbd-a67f-16e81911362f",
      "name": "Read inbox messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        140,
        425
      ]
    },
    {
      "id": "bdedf5a0-742b-473a-aac3-6c3e9eaaf050",
      "name": "Html to Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        580,
        25
      ]
    },
    {
      "id": "980cc13d-4dc8-48b8-ad71-616b72cb6399",
      "name": "Read messages from FAQ Waiting folder",
      "type": "n8n-nodes-base.gmail",
      "position": [
        140,
        800
      ]
    },
    {
      "id": "a5012630-fc33-405e-afdd-86df29563264",
      "name": "Remove from inbox",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1420,
        0
      ]
    },
    {
      "id": "bd88b2c2-7e2a-4db9-9ade-801f7692d18f",
      "name": "Remove from FAQ Waiting",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1140,
        800
      ]
    },
    {
      "id": "babb8136-7407-4f05-8bcb-1412492f38aa",
      "name": "Google Gemini Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1320,
        420
      ]
    },
    {
      "id": "0936acb0-adb6-4fb5-ba6f-f06acb39bc10",
      "name": "Add Label Inbound",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1980,
        360
      ]
    },
    {
      "id": "8794c3dc-d66b-4a96-be35-804af67767d1",
      "name": "Q&A e-mail ?",
      "type": "n8n-nodes-base.if",
      "position": [
        1160,
        20
      ]
    },
    {
      "id": "e3c07451-48e9-414a-9413-f0f0cfbe8b7e",
      "name": "Inbound e-mail ?",
      "type": "n8n-nodes-base.if",
      "position": [
        1660,
        380
      ]
    },
    {
      "id": "9d648051-d50a-47ce-877f-62dd2fba8fb3",
      "name": "Remove from inbox 2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1820,
        240
      ]
    },
    {
      "id": "25648438-bfa0-43af-9544-39ddea72ef95",
      "name": "Add Label FAQ Waiting",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1700,
        0
      ]
    },
    {
      "id": "98949cdc-1f21-4b59-95f3-42121fe9b3ce",
      "name": "Add Label FAQ Draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1340,
        800
      ]
    },
    {
      "id": "17d7d0f5-5182-4061-9ee3-bb346b7fc8f9",
      "name": "Set E-mail Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1500,
        800
      ]
    },
    {
      "id": "3e2482ce-e4a8-4579-9a08-963523889310",
      "name": "Draft reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1660,
        800
      ]
    },
    {
      "id": "1deabcc9-65f0-404f-a15b-0475bc0f8bab",
      "name": "Q&A table as a resource",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        960,
        980
      ]
    },
    {
      "id": "ffc9fb3e-22eb-4977-b7fd-2c965488b9d7",
      "name": "AI Agent - checks if e mail is FAQ related",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        800,
        25
      ]
    },
    {
      "id": "b9a85521-c782-4841-80be-0284cad19fc2",
      "name": "AI Agent - checks if e-mail is Inbound related",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1300,
        240
      ]
    },
    {
      "id": "fe7b95e8-d2be-4ca9-b038-53f09124c44f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        720
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "7dea811e-d30a-4001-a3ac-be865a3418c4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        -40
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "f2ea8012-fe19-498b-b676-fa9ad3dafefc",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        200
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "c3af6366-2465-4687-bbe3-a1d7cf6f6327",
      "name": "AI Agent - draft a reply to FAQ Question",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        800,
        800
      ]
    }
  ],
  "connections": {
    "Markdown1": {
      "main": [
        [
          {
            "node": "AI Agent - draft a reply to FAQ Question",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Draft reply": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Q&A e-mail ?": {
      "main": [
        [
          {
            "node": "Remove from inbox",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent - checks if e-mail is Inbound related",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent - checks if e mail is FAQ related",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Html to Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Html to Markdown": {
      "main": [
        [
          {
            "node": "AI Agent - checks if e mail is FAQ related",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inbound e-mail ?": {
      "main": [
        [
          {
            "node": "Remove from inbox 2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [],
        [
          {
            "node": "Markdown1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Read inbox messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Label Inbound": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove from inbox": {
      "main": [
        [
          {
            "node": "Add Label FAQ Waiting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "Read messages from FAQ Waiting folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set E-mail Fields": {
      "main": [
        [
          {
            "node": "Draft reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Label FAQ Draft": {
      "main": [
        [
          {
            "node": "Set E-mail Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read inbox messages": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove from inbox 2": {
      "main": [
        [
          {
            "node": "Add Label Inbound",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Label FAQ Waiting": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Q&A table as a resource": {
      "ai_tool": [
        [
          {
            "node": "AI Agent - draft a reply to FAQ Question",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Remove from FAQ Waiting": {
      "main": [
        [
          {
            "node": "Add Label FAQ Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - checks if e mail is FAQ related",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - draft a reply to FAQ Question",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - checks if e-mail is Inbound related",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Read messages from FAQ Waiting folder": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - draft a reply to FAQ Question": {
      "main": [
        [
          {
            "node": "Remove from FAQ Waiting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - checks if e mail is FAQ related": {
      "main": [
        [
          {
            "node": "Q&A e-mail ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - checks if e-mail is Inbound related": {
      "main": [
        [
          {
            "node": "Inbound e-mail ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}