{
  "name": "Gmail auto-reply generator with ChatGPT",
  "nodes": [
    {
      "id": "50972917-6da6-4b55-b18b-0bd96445e9f8",
      "name": "Trigger on New Email",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        -352
      ]
    },
    {
      "id": "f42bb871-a182-4708-aa12-65f6c9c5ee28",
      "name": "Get Unread Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        -352
      ]
    },
    {
      "id": "c0ce4d37-a5ce-4926-9edf-5aa68d80426a",
      "name": "Get Required Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        448,
        -352
      ]
    },
    {
      "id": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        672,
        -352
      ]
    },
    {
      "id": "5673e94b-82b0-407f-9db4-60b35dfb8253",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        680,
        -128
      ]
    },
    {
      "id": "00fe0a38-cc10-492e-86d6-af0494c8afc9",
      "name": "Structured Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        808,
        -128
      ]
    },
    {
      "id": "7fd55349-a8a3-4c1b-8dc8-221a50915a5e",
      "name": "Can AI Agent Respond?",
      "type": "n8n-nodes-base.if",
      "position": [
        1024,
        -352
      ]
    },
    {
      "id": "ba0480ca-4f1d-4813-b6d8-674ec1f2bafe",
      "name": "Create a draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1248,
        -352
      ]
    },
    {
      "id": "be177f90-54e7-472f-8b30-3dd6c8c1f4a3",
      "name": "Label Email As \"Action\"",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1472,
        -352
      ]
    },
    {
      "id": "434ebfe4-410a-4f49-9285-cfd6256abb6f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        0
      ],
      "parameters": {
        "width": 336,
        "height": null,
        "content": "## 🛠️ Setup Instructions\n  - Connect Gmail and OpenAI credentials before activating.\n  - Make sure your Gmail has a label called `Action`."
      }
    },
    {
      "id": "77831399-3e74-454e-8e27-b9d6e2af638c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        -576
      ],
      "parameters": {
        "width": 368,
        "height": 656,
        "content": "## ⚠️ Reply Logic\n  - AI won't reply to spam, notifications, or irrelevant messages.\n  - Only genuine messages get responses. You can review drafts before sending.\n  - Tweak the AI agent's prompt to m"
      }
    }
  ],
  "connections": {
    "OpenAI": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Can AI Agent Respond?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a draft": {
      "main": [
        [
          {
            "node": "Label Email As \"Action\"",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Unread Email": {
      "main": [
        [
          {
            "node": "Get Required Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Get Required Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger on New Email": {
      "main": [
        [
          {
            "node": "Get Unread Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Can AI Agent Respond?": {
      "main": [
        [
          {
            "node": "Create a draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}