{
  "name": "Smart Gmail inbox management with Gemini: Auto-label and draft replies",
  "nodes": [
    {
      "id": "9f9eac49-b13b-47d2-9801-3c46c11cddc2",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        -208
      ]
    },
    {
      "id": "a66eeb1f-57ee-4b43-9aea-6abeb47c9a1c",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        832,
        16
      ]
    },
    {
      "id": "f3d14e47-7403-481f-a15d-87adf9713bdb",
      "name": "RemoveLabel",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        -208
      ]
    },
    {
      "id": "1883ad7e-1712-4f95-9164-8b1742d08343",
      "name": "AddLabel",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1264,
        -112
      ]
    },
    {
      "id": "a4c1fbf6-4111-4d97-9ea3-8963f48b1648",
      "name": "TrashMessage",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1264,
        -304
      ]
    },
    {
      "id": "94a9bed2-df2c-4e55-87ed-5aa495a9f0ea",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -544
      ],
      "parameters": {
        "width": 544,
        "height": 720,
        "content": "## Classify emails\n\nThis step uses Gemini (or any compatible AI model) to automatically categorize incoming emails.\nThe model follows your predefined Gmail labels to decide where each message belongs."
      }
    },
    {
      "id": "96e9fbad-4274-4649-8f71-1a97bba948df",
      "name": "GetThread",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        576,
        16
      ]
    },
    {
      "id": "335c960f-eedc-4d90-9fd6-6e174fdcd0a8",
      "name": "CheckSent",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        704,
        16
      ]
    },
    {
      "id": "9db911b8-430c-41a8-8dd2-09f446526358",
      "name": "Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1296,
        208
      ]
    },
    {
      "id": "390214f0-5930-4655-a2c4-b0a814652388",
      "name": "IF Delete",
      "type": "n8n-nodes-base.if",
      "position": [
        1040,
        -208
      ]
    },
    {
      "id": "fdf0e08d-5184-4ae4-aa5e-ed8dc1bd1f00",
      "name": "IF Response",
      "type": "n8n-nodes-base.if",
      "position": [
        1488,
        -112
      ]
    },
    {
      "id": "4ad414d5-1f4d-42e6-9ee4-c6e3f3b348d4",
      "name": "Create a draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2176,
        -112
      ]
    },
    {
      "id": "242f05bd-60e6-4e78-87c3-a4c96647ce18",
      "name": "GetThread1",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        1712,
        112
      ]
    },
    {
      "id": "8df829c7-fb54-41fd-bd6e-dc3e6f35ddbf",
      "name": "CheckCalendar",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        1840,
        112
      ]
    },
    {
      "id": "7d87941c-a1d7-4476-ba1d-ad60a08c08ad",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1984,
        112
      ]
    },
    {
      "id": "cf93dee2-2c6c-4d01-ab7c-442bd32a1d7b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -400
      ],
      "parameters": {
        "width": 608,
        "height": 656,
        "content": "## Draft response\nWhen an email needs a reply, this step creates a short, friendly draft you can review before sending.\nThe AI reads the full conversation for context and, if scheduling is mentioned, "
      }
    },
    {
      "id": "e44b892d-b865-4fd2-86f7-6750f621fef4",
      "name": "AI Email Classifier",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        568,
        -208
      ]
    },
    {
      "id": "db5ab5f9-320c-4b89-ba46-5ea013109f64",
      "name": "AI Draft Maker",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1768,
        -112
      ]
    },
    {
      "id": "739c6768-6fa3-45fe-ab51-84b07da6e6a0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        -448
      ],
      "parameters": {
        "width": 544,
        "height": 608,
        "content": "# AI Gmail Manager\n\nThis workflow automatically classifies incoming Gmail messages and, when needed, creates reply drafts using AI.\nIt’s designed to keep your inbox organized and help you respond fast"
      }
    }
  ],
  "connections": {
    "Gemini": {
      "ai_languageModel": [
        [
          {
            "node": "AI Email Classifier",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "AI Draft Maker",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AddLabel": {
      "main": [
        [
          {
            "node": "IF Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CheckSent": {
      "ai_tool": [
        [
          {
            "node": "AI Email Classifier",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "GetThread": {
      "ai_tool": [
        [
          {
            "node": "AI Email Classifier",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "IF Delete": {
      "main": [
        [
          {
            "node": "TrashMessage",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AddLabel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetThread1": {
      "ai_tool": [
        [
          {
            "node": "AI Draft Maker",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "IF Response": {
      "main": [
        [
          {
            "node": "AI Draft Maker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RemoveLabel": {
      "main": [
        [
          {
            "node": "AI Email Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CheckCalendar": {
      "ai_tool": [
        [
          {
            "node": "AI Draft Maker",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "RemoveLabel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Draft Maker": {
      "main": [
        [
          {
            "node": "Create a draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Email Classifier": {
      "main": [
        [
          {
            "node": "IF Delete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Email Classifier",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Draft Maker",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}