{
  "name": "Read, analyze, and auto-reply to Gmail emails with OpenAI, Slack, and Sheets",
  "nodes": [
    {
      "id": "3c182993-eac4-45d7-948a-f48c58feec2d",
      "name": "Overview & Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2032,
        -64
      ],
      "parameters": {
        "width": 1200,
        "height": 1080,
        "content": "## 📧 n8n OpenCWL AI Email Automation\n### Read, Analyze & Auto-Reply to Emails Intelligently\n\n---\n\n### 📋 Description\nA fully automated, AI-powered email assistant built in n8n that reads incoming email"
      }
    },
    {
      "id": "48a97cfe-4b2c-4c6a-a7e0-b811739bf9bc",
      "name": "1. Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3264,
        -48
      ],
      "parameters": {
        "width": 480,
        "height": 760,
        "content": "## 1. Trigger & Fetch Email\nGmail polling → extract & clean email content"
      }
    },
    {
      "id": "2476c991-8e66-4b38-9ea3-d485b278723a",
      "name": "2. Analysis Phase",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3760,
        -48
      ],
      "parameters": {
        "width": 520,
        "height": 740,
        "content": "## 2. AI Analysis\nClassify category + analyze sentiment with OpenAI"
      }
    },
    {
      "id": "319e1676-ac9a-49f6-8544-886cf5d14231",
      "name": "3. Reply Generation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4304,
        -48
      ],
      "parameters": {
        "width": 520,
        "height": 720,
        "content": "## 3. Draft AI Reply\nGenerate professional context-aware email reply"
      }
    },
    {
      "id": "79e277f5-9303-4e32-a49d-de860225e7e1",
      "name": "4. Escalation Gate",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4832,
        -48
      ],
      "parameters": {
        "width": 420,
        "height": 700,
        "content": "## 4. Escalation Gate\nUrgent / Negative → human escalation via Slack"
      }
    },
    {
      "id": "5b6b0a70-da91-4938-9d9c-7496ca132387",
      "name": "5. Output Phase",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5280,
        -48
      ],
      "parameters": {
        "width": 560,
        "height": 696,
        "content": "## 5. Send, Log & Notify\nAuto-reply → Gmail label → Sheets log → Slack summary"
      }
    },
    {
      "id": "478335d7-4034-4d79-9024-3bcf6c923ddb",
      "name": "Gmail: Watch Inbox",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        3360,
        336
      ]
    },
    {
      "id": "1033c995-f15f-4dab-955d-6131d369edf6",
      "name": "Schedule (fallback)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        3360,
        544
      ]
    },
    {
      "id": "a7d974c1-2cd1-4911-adcf-2875fd4de29a",
      "name": "Set Email Config",
      "type": "n8n-nodes-base.set",
      "position": [
        3584,
        448
      ]
    },
    {
      "id": "a0548987-a4ab-4221-b071-0603d27a388c",
      "name": "Extract & Clean Email",
      "type": "n8n-nodes-base.code",
      "position": [
        3584,
        240
      ]
    },
    {
      "id": "29ce75be-be3f-421d-9e29-2cafb0e7098e",
      "name": "Parse Analysis",
      "type": "n8n-nodes-base.code",
      "position": [
        4080,
        336
      ]
    },
    {
      "id": "417dd630-1057-4bdb-bad1-afd2e13af06b",
      "name": "Prepare Reply Data",
      "type": "n8n-nodes-base.code",
      "position": [
        4560,
        336
      ]
    },
    {
      "id": "82e780f4-26c4-44ad-8033-56aeaeea56ae",
      "name": "Needs Escalation?",
      "type": "n8n-nodes-base.if",
      "position": [
        4896,
        336
      ]
    },
    {
      "id": "0dc708d1-55fe-4815-9a10-e255515d2826",
      "name": "Slack: Escalate to Human",
      "type": "n8n-nodes-base.slack",
      "position": [
        5120,
        240
      ]
    },
    {
      "id": "b6035a37-a4ca-4995-9054-824a5d60b011",
      "name": "Gmail: Send Auto-Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5120,
        448
      ]
    },
    {
      "id": "c8669435-35e5-40a6-9393-88ad4b08f64c",
      "name": "Gmail: Apply Label",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5312,
        448
      ]
    },
    {
      "id": "e37d7b66-fa7a-4da0-9cc7-966acd423785",
      "name": "Google Sheets: Log Email",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5520,
        448
      ]
    },
    {
      "id": "ce85af1e-b5b9-480c-a75d-b8de6a2d9e20",
      "name": "Slack: Notify Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        5712,
        448
      ]
    },
    {
      "id": "e3b68a44-4931-4684-81e4-ed432d7fbb71",
      "name": "OpenAI: Classify & Analyze",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        3824,
        336
      ]
    },
    {
      "id": "f445b94e-32c6-4a11-b221-b8bfaa931414",
      "name": "OpenAI: Draft Reply",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        4368,
        336
      ]
    }
  ],
  "connections": {
    "Parse Analysis": {
      "main": [
        [
          {
            "node": "OpenAI: Draft Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Email Config": {
      "main": [
        [
          {
            "node": "OpenAI: Classify & Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs Escalation?": {
      "main": [
        [
          {
            "node": "Slack: Escalate to Human",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail: Send Auto-Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail: Apply Label": {
      "main": [
        [
          {
            "node": "Google Sheets: Log Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail: Watch Inbox": {
      "main": [
        [
          {
            "node": "Extract & Clean Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Reply Data": {
      "main": [
        [
          {
            "node": "Needs Escalation?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack: Notify Team": {
      "main": [
        []
      ]
    },
    "OpenAI: Draft Reply": {
      "main": [
        [
          {
            "node": "Prepare Reply Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule (fallback)": {
      "main": [
        [
          {
            "node": "Set Email Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract & Clean Email": {
      "main": [
        [
          {
            "node": "Set Email Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail: Send Auto-Reply": {
      "main": [
        [
          {
            "node": "Gmail: Apply Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets: Log Email": {
      "main": [
        [
          {
            "node": "Slack: Notify Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI: Classify & Analyze": {
      "main": [
        [
          {
            "node": "Parse Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}