{
  "name": "Classify and auto-reply to Gmail with OpenAI, Google Sheets RAG and Telegram",
  "nodes": [
    {
      "id": "ab088a6d-d9d3-4802-ab52-68ab4f8f03b6",
      "name": "High Priority1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1584,
        -3072
      ]
    },
    {
      "id": "78bc3e3b-a93a-41b0-8338-13da896accc6",
      "name": "Customer Support1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1584,
        -2672
      ]
    },
    {
      "id": "e404fdb0-b2d9-4353-a459-f78a3df042b9",
      "name": "Promotion1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1600,
        -2256
      ]
    },
    {
      "id": "52392013-8f98-4896-89c3-fec1f0a68723",
      "name": "Finance/Billing1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1600,
        -1888
      ]
    },
    {
      "id": "2e9b9bb2-3425-469c-9847-22bf92a0cc6e",
      "name": "Creating Draft1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1808,
        -3072
      ]
    },
    {
      "id": "78e4e690-11f1-48d0-8e4b-4b9131b3c69c",
      "name": "Creating Email1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1824,
        -2672
      ]
    },
    {
      "id": "1d6ad4cd-1f3e-4103-bcfb-50551e9b34b8",
      "name": "Draft1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2160,
        -3072
      ]
    },
    {
      "id": "4c4ed33d-4b29-4484-b193-5551e4d8134b",
      "name": "Auto Reply1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2160,
        -2672
      ]
    },
    {
      "id": "95fe3543-e9b2-473b-9352-0fd082a8b254",
      "name": "Send to Finance Dept1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2176,
        -1888
      ]
    },
    {
      "id": "7c7576b3-e261-403c-b19d-450ef98d2379",
      "name": "Notify (1)1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2832,
        -3072
      ]
    },
    {
      "id": "2793c504-5805-416a-9475-ccefcca88403",
      "name": "Notify (2)1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2832,
        -2672
      ]
    },
    {
      "id": "2e3a1db5-6232-4320-acdb-5d322986540f",
      "name": "Notify (3)1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2624,
        -2256
      ]
    },
    {
      "id": "e5ffee10-0064-455d-a44e-620ce6f5cc28",
      "name": "Notify (4)1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2848,
        -1888
      ]
    },
    {
      "id": "3471f590-5c53-474d-abfe-0e507c1b8885",
      "name": "Gmail Trigger1",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        672,
        -2448
      ]
    },
    {
      "id": "1961b370-4b12-43ab-a24f-449dbd6334f0",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        944,
        -432
      ]
    },
    {
      "id": "37963fb1-20e8-42f3-a044-e023cdd8d64c",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        720,
        -432
      ]
    },
    {
      "id": "56075617-5897-4520-b91a-65bf954f6925",
      "name": "Send Demo Emails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1168,
        -432
      ]
    },
    {
      "id": "03343623-3a36-4e40-998b-203bc72e4e9f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -560
      ],
      "parameters": {
        "width": 800,
        "height": 432,
        "content": "## Demo Email Generator\nSends sample emails to test classification logic.\n"
      }
    },
    {
      "id": "b2b0d54e-7138-4bde-9422-2c1193976b5f",
      "name": "Mark as Read",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2384,
        -3072
      ]
    },
    {
      "id": "8acf7218-c375-43dd-a83f-451f878a66a6",
      "name": "Remove From Inbox",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2608,
        -3072
      ]
    },
    {
      "id": "cadf9fb5-4303-4698-bb3c-5470e580f179",
      "name": "Mark as Read1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2384,
        -2672
      ]
    },
    {
      "id": "a4925b85-3ccb-414c-abca-74891a993337",
      "name": "Remove From Inbox1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2608,
        -2672
      ]
    },
    {
      "id": "4d45871c-e67b-4fd8-bd1a-38ed7b2f77e7",
      "name": "Mark as Read2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2176,
        -2256
      ]
    },
    {
      "id": "d060edb0-2527-492c-9e9b-f1dd31c5c3d0",
      "name": "Remove From Inbox2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2400,
        -2256
      ]
    },
    {
      "id": "e18fa4fd-d770-4a67-90f4-4278189a931f",
      "name": "Mark as Read3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2400,
        -1888
      ]
    },
    {
      "id": "1fcbb724-4fa6-4e99-ad5b-41d06d34127d",
      "name": "Remove From Inbox3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2624,
        -1888
      ]
    },
    {
      "id": "e7cfa408-c22c-4ba8-bd15-712fbda814b9",
      "name": "Email Classifier Agent",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        896,
        -2448
      ]
    },
    {
      "id": "aebbf62b-2c4e-4426-9707-daed2e06f615",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        1248,
        -2480
      ]
    },
    {
      "id": "6bcf1e73-c19d-43dc-9db8-c60bdf8e6ba4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1776,
        -576
      ],
      "parameters": {
        "width": 800,
        "height": 432,
        "content": "## Demo Cleanup\nDeletes test emails to reset the inbox.\n"
      }
    },
    {
      "id": "4df01370-51e2-4967-ba70-acc7463c88e7",
      "name": "Read_all_Emails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1840,
        -432
      ]
    },
    {
      "id": "7a3aa5fe-8848-420d-a314-d7603c7c3c90",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2048,
        -432
      ]
    },
    {
      "id": "f3bc636a-b1f0-4919-9998-7c524e55ca25",
      "name": "Delete a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2352,
        -384
      ]
    },
    {
      "id": "b1c36e59-4a3a-459a-aa7d-b15824fce210",
      "name": "Clean Inbox",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2336,
        -544
      ]
    },
    {
      "id": "6e37cb34-6e8e-41a5-9885-7a09aa866522",
      "name": "FTAI Info",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1984,
        -2432
      ]
    },
    {
      "id": "1fdd5bcc-6660-42c5-9cd5-d7d38431e04b",
      "name": "Promotions",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1824,
        -2256
      ]
    },
    {
      "id": "2b5e9edf-0a1e-49fd-8dec-9aa578804657",
      "name": "Finance / Billing Dept",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1824,
        -1888
      ]
    },
    {
      "id": "fa2d5f16-6b24-408b-96f4-79fbff8a9471",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -2784
      ],
      "parameters": {
        "width": 1008,
        "height": 560,
        "content": "# 📨 Gmail Classifier —Classify emails using AI and automate responses\n\n## How it works\nThis workflow monitors incoming Gmail messages and uses an AI classifier to categorize each email into High Prior"
      }
    },
    {
      "id": "2e35c35e-a4f7-4052-8757-5a8458a763fa",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -928
      ],
      "parameters": {
        "width": 464,
        "height": 320,
        "content": "## 📤 Send Demo Emails (Testing and Simulating bulk email)\n\n### 📝 What This Does  \nQuickly sends a batch of demo emails to your Gmail inbox so you can test every category without manually sending anyth"
      }
    },
    {
      "id": "68ec13fa-0dad-4c2e-964c-bc36d632166e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1792,
        -832
      ],
      "parameters": {
        "width": 688,
        "height": 192,
        "content": "## 🗑️ Delete Demo Emails (⚠️ Wipes Inbox — Use Carefully)\n\n### 📝 What This Does  \nDeletes all demo/test emails from your Gmail inbox so you can start fresh for the next testing cycle.\n\nBe VERY CAREFUL"
      }
    },
    {
      "id": "9437b754-0640-419b-94b5-cd378a354c5c",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        -3056
      ],
      "parameters": {
        "width": 336,
        "height": 112,
        "content": "## High Priority Emails\nA Draft will be created for Human in the Loop"
      }
    },
    {
      "id": "4510d3c3-2c8d-4df9-8f91-2930bd946483",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -3232
      ],
      "parameters": {
        "width": 272,
        "height": 128,
        "content": "## Human in the Loop Review\n**Before sending out"
      }
    },
    {
      "id": "0977808f-5b1b-43fa-bf3e-b10372367f24",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        -2848
      ],
      "parameters": {
        "width": 352,
        "height": 144,
        "content": "## Customer Support Auto-Responder\nAI generates replies using internal Q&A and SOP data.\n"
      }
    },
    {
      "id": "c821488f-a542-417b-af4a-2c3966ec1d52",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -1152
      ],
      "parameters": {
        "width": 2496,
        "height": 128,
        "content": "## Demo Email setup and Cleanup ( Activate if Needed)\n"
      }
    }
  ],
  "connections": {
    "Draft1": {
      "main": [
        [
          {
            "node": "Mark as Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "High Priority1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Customer Support1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Promotion1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Finance/Billing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FTAI Info": {
      "ai_tool": [
        [
          {
            "node": "Creating Email1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Promotion1": {
      "main": [
        [
          {
            "node": "Promotions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Promotions": {
      "main": [
        [
          {
            "node": "Mark as Read2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Auto Reply1": {
      "main": [
        [
          {
            "node": "Mark as Read1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Read": {
      "main": [
        [
          {
            "node": "Remove From Inbox",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Read1": {
      "main": [
        [
          {
            "node": "Remove From Inbox1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Read2": {
      "main": [
        [
          {
            "node": "Remove From Inbox2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Read3": {
      "main": [
        [
          {
            "node": "Remove From Inbox3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger1": {
      "main": [
        [
          {
            "node": "Email Classifier Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "High Priority1": {
      "main": [
        [
          {
            "node": "Creating Draft1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Creating Draft1": {
      "main": [
        [
          {
            "node": "Draft1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Creating Email1": {
      "main": [
        [
          {
            "node": "Auto Reply1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Clean Inbox",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read_all_Emails": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete a message": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Finance/Billing1": {
      "main": [
        [
          {
            "node": "Finance / Billing Dept",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer Support1": {
      "main": [
        [
          {
            "node": "Creating Email1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove From Inbox": {
      "main": [
        [
          {
            "node": "Notify (1)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove From Inbox1": {
      "main": [
        [
          {
            "node": "Notify (2)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove From Inbox2": {
      "main": [
        [
          {
            "node": "Notify (3)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove From Inbox3": {
      "main": [
        [
          {
            "node": "Notify (4)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Send Demo Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to Finance Dept1": {
      "main": [
        [
          {
            "node": "Mark as Read3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Classifier Agent": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Finance / Billing Dept": {
      "main": [
        [
          {
            "node": "Send to Finance Dept1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}