{
  "name": "Automate email management with OpenAI classification, Gmail drafts & Slack alerts",
  "nodes": [
    {
      "id": "e777600d-4456-4bcd-b356-231a340e8da7",
      "name": "Workflow Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        140
      ],
      "parameters": {
        "width": 550,
        "height": 1300,
        "content": "## Intelligent Email Assistant with AI Classification, Gmail Drafts, and Slack Notifications\n\n**Created by [ZenAgent Labs](https://zenagentlabs.com)**\n\n![ZenAgent Labs Logo](https://zntl.de/wp-content"
      }
    },
    {
      "id": "5825d614-da89-4262-810b-074f5a788ac4",
      "name": "Gmail Setup Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        680
      ],
      "parameters": {
        "width": 380,
        "height": 580,
        "content": "## Gmail Label Setup Instructions\n\n**IMPORTANT:** You need to create these Gmail labels first:\n\n1. **Primary Label:** 'AI-Agent' (trigger label)\n2. **Classification Labels:**\n   - 'Inquiry' \n   - 'Sup"
      }
    },
    {
      "id": "6a4ce1eb-3e14-4f7b-8dd2-884858e9edd3",
      "name": "Gmail Trigger - AI Agent Label",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        520,
        660
      ]
    },
    {
      "id": "575d0664-15f9-4c1a-bb85-702aa7406f02",
      "name": "Extract Email Data",
      "type": "n8n-nodes-base.set",
      "position": [
        740,
        660
      ]
    },
    {
      "id": "9dc28e85-da76-4a56-bab7-2449eeeabd5a",
      "name": "AI Agent - Email Classifier",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        960,
        660
      ]
    },
    {
      "id": "32502ca5-832f-4bf6-85b8-18452071d589",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        920,
        920
      ]
    },
    {
      "id": "73c4e031-badb-4562-b791-4843c4b12cf9",
      "name": "Parse AI Classification",
      "type": "n8n-nodes-base.code",
      "position": [
        1280,
        660
      ]
    },
    {
      "id": "858a4fbf-7ba3-497b-955c-20be5d6148c0",
      "name": "AI Classification Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        920,
        140
      ],
      "parameters": {
        "width": 380,
        "height": 380,
        "content": "## AI Classification Logic\n\nThe AI analyzes emails based on:\n- **Sender domain** and content\n- **Keywords** in subject/content\n- **Tone** and urgency indicators\n- **Request patterns**\n\nConfidence valu"
      }
    },
    {
      "id": "cfa9478c-ed03-4c78-b910-be6e48528888",
      "name": "Add Classification Label",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1480,
        660
      ]
    },
    {
      "id": "30ca3a6d-775d-485c-b978-3b902d94bda4",
      "name": "Route by Category",
      "type": "n8n-nodes-base.switch",
      "position": [
        1680,
        660
      ]
    },
    {
      "id": "2bb9e810-b62b-43b5-9018-8a4ee43da90e",
      "name": "Success Actions Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2440,
        280
      ],
      "parameters": {
        "width": 320,
        "height": 280,
        "content": "## Workflow Actions Summary\n\n✅ **Inquiry/Support emails** → Draft responses created\n✅ **Action Items** → Slack notifications sent\n✅ **Newsletters** → Slack summaries sent\n✅ **All emails** → Automatica"
      }
    },
    {
      "id": "713a3bc5-8e0f-46f4-ad9b-87d7adc07dbd",
      "name": "Error Handling Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2440,
        600
      ],
      "parameters": {
        "width": 320,
        "height": 240,
        "content": "## Error Handling & Monitoring\n\n### Current Features:\n- Fallback classification to 'Support'\n- JSON parsing error handling\n- Confidence scoring for accuracy\n\n### Enhancement Options:\n- Error notificat"
      }
    },
    {
      "id": "ba402d17-fb77-419e-87f2-f00414cf0892",
      "name": "Create Draft Response",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2080,
        460
      ]
    },
    {
      "id": "59934725-d2f3-4faf-a9db-8a4187a81081",
      "name": "Send Action Item Slack Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        2080,
        840
      ]
    },
    {
      "id": "78cce31c-12b8-4c89-b362-07f92be4b3a9",
      "name": "Send Newsletter Summary to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        2080,
        660
      ]
    },
    {
      "id": "f19d4daa-ff84-4421-8170-c7c9c86321f2",
      "name": "Slack Setup Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1940,
        20
      ],
      "parameters": {
        "width": 380,
        "height": 360,
        "content": "## Slack Integration Setup\n\n### Required Configuration:\n1. **Create Slack App** at api.slack.com\n2. **Add OAuth Scopes:**\n   - `chat:write`\n   - `channels:read`\n   - `users:read`\n\n3. **Create Channels"
      }
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Email Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Route by Category": {
      "main": [
        [
          {
            "node": "Create Draft Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Draft Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Newsletter Summary to Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Action Item Slack Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Email Data": {
      "main": [
        [
          {
            "node": "AI Agent - Email Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Classification": {
      "main": [
        [
          {
            "node": "Add Classification Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Classification Label": {
      "main": [
        [
          {
            "node": "Route by Category",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - Email Classifier": {
      "main": [
        [
          {
            "node": "Parse AI Classification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger - AI Agent Label": {
      "main": [
        [
          {
            "node": "Extract Email Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}