{
  "name": "Route Gmail emails to Slack by intent using OpenAI and log to Sheets",
  "nodes": [
    {
      "id": "0bc65b77-b74c-4d4a-8b70-36b0c7aacbac",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        -256
      ],
      "parameters": {
        "width": 440,
        "height": 792,
        "content": "### Route incoming emails to Slack channels by intent using OpenAI\n\nIf your team is drowning in a shared inbox and someone has to manually read every email to figure out where it should go, this takes"
      }
    },
    {
      "id": "4692fa09-93d5-4af3-9143-49f116f4b2ea",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -160
      ],
      "parameters": {
        "width": 280,
        "height": null,
        "content": "## 1. New email comes in\nGmail trigger polls every minute. You can change this to whatever interval you want."
      }
    },
    {
      "id": "9bfec79e-5603-4600-b479-00ca907ffb55",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        224
      ],
      "parameters": {
        "width": 300,
        "height": null,
        "content": "## 2. Settings and extraction\nPulls out the sender, subject, and body. Also holds your Slack channel IDs and Sheet ID."
      }
    },
    {
      "id": "57281ada-b74b-4673-97ec-666737a84304",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        -160
      ],
      "parameters": {
        "width": 320,
        "height": null,
        "content": "## 3. AI classifies the email\nOpenAI reads the email and decides: is this sales, support, billing, or spam? Also gives you a summary and priority level."
      }
    },
    {
      "id": "1185463b-07c2-4682-829d-903137a39d81",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        -160
      ],
      "parameters": {
        "width": 968,
        "height": 716,
        "content": "## 4. Route to the right channel\nSales emails go to #sales, support goes to #support, billing goes to #billing. Spam gets dropped entirely."
      }
    },
    {
      "id": "cb4ffded-6fd1-4b20-aac5-03b6d95a6eba",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2288,
        -64
      ],
      "parameters": {
        "width": 300,
        "height": null,
        "content": "## 5. Log everything\nEvery email gets recorded to Google Sheets with the AI's classification. Handy for reporting and catching anything the AI gets wrong."
      }
    },
    {
      "id": "b9147c92-f84f-4ba0-9b81-43dba3018676",
      "name": "Watch for New Emails",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        544,
        32
      ]
    },
    {
      "id": "8adb6be0-5c32-4e2b-8ba8-7b42158f5069",
      "name": "Configure Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        768,
        32
      ]
    },
    {
      "id": "f4b994e7-4c0b-479a-8110-2678cdcde227",
      "name": "Classify Email Intent",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        992,
        32
      ]
    },
    {
      "id": "d39a73d8-fcf4-454d-993c-beb8667a8cb6",
      "name": "Parse AI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1344,
        32
      ]
    },
    {
      "id": "32d9dee1-fe9d-4c09-862c-b31714fae5f5",
      "name": "Route by Category",
      "type": "n8n-nodes-base.switch",
      "position": [
        1552,
        208
      ]
    },
    {
      "id": "bdfe3556-6aa3-448c-82be-e5d0205f7e6b",
      "name": "Send to Sales Channel",
      "type": "n8n-nodes-base.slack",
      "position": [
        1824,
        64
      ]
    },
    {
      "id": "9942f989-3390-4414-9323-d66a18ef9903",
      "name": "Send to Support Channel",
      "type": "n8n-nodes-base.slack",
      "position": [
        1824,
        224
      ]
    },
    {
      "id": "7744412e-a6ee-4b45-b0ee-5d7de4054f43",
      "name": "Send to Billing Channel",
      "type": "n8n-nodes-base.slack",
      "position": [
        1824,
        384
      ]
    },
    {
      "id": "dbf11939-86b5-4ec0-b5b3-d9c8b09d9a1b",
      "name": "Log to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2048,
        -48
      ]
    }
  ],
  "connections": {
    "Parse AI Response": {
      "main": [
        [
          {
            "node": "Route by Category",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Category": {
      "main": [
        [
          {
            "node": "Send to Sales Channel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send to Support Channel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send to Billing Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure Settings": {
      "main": [
        [
          {
            "node": "Classify Email Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch for New Emails": {
      "main": [
        [
          {
            "node": "Configure Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Email Intent": {
      "main": [
        [
          {
            "node": "Parse AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}