{
  "name": "Categorize and label existing Gmail emails automatically with GPT-4o mini",
  "nodes": [
    {
      "id": "a31a7280-34ee-44bf-80e4-0a366ab0e649",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        1392
      ],
      "parameters": {
        "width": 736,
        "height": 972,
        "content": "## 1. Manual Trigger + Gmail Fetch + Label Checker\n[Read more about Manual Trigger node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.manualworkflowtrigger/?utm_source=n8n_app&ut"
      }
    },
    {
      "id": "69df5c49-b33d-4d71-a687-b60650f17297",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        1392
      ],
      "parameters": {
        "width": 588,
        "height": 1628,
        "content": "## 📨 Categorize and Label Existing Gmail Emails Automatically with GPT-4o mini\n\n## 👥 Who's it for\n\nThis workflow is perfect for individuals or teams who want to sort and label existing emails in their"
      }
    },
    {
      "id": "fd2816b9-05f1-4717-8a48-eee68b34e9ed",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        1392
      ],
      "parameters": {
        "width": 560,
        "height": 972,
        "content": "## 2. AI Categorization + Structured Output\n\n[Read more about AI Agent node](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/?utm_source=n8n_app&utm_medium="
      }
    },
    {
      "id": "f36f9faf-daa7-47ac-8508-46dda10483e9",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        1392
      ],
      "parameters": {
        "width": 760,
        "height": 1620,
        "content": "## 3. Apply labels based on AI output\n[Read more about Switch node editing](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.switch/?utm_source=n8n_app&utm_medium=node_settings_modal"
      }
    },
    {
      "id": "23ffde1f-a7ec-47e8-b4bb-6f1741e32074",
      "name": "Give a Label AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        336,
        1792
      ]
    },
    {
      "id": "1bd62e9b-2b93-4e79-99c0-f993a04079b3",
      "name": "Label Checker Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        0,
        1792
      ]
    },
    {
      "id": "c2d50354-0427-41bf-89f8-fb931bfcaefa",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        832,
        2096
      ]
    },
    {
      "id": "1300cdf3-5b22-45ee-af81-5d94723c10e3",
      "name": "Work",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        1712
      ]
    },
    {
      "id": "cb4ea5c6-a638-425d-8b45-a8621a8a0e33",
      "name": "Personal",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        1872
      ]
    },
    {
      "id": "1db6e7ff-6770-4a66-8f05-3fae33b597f0",
      "name": "Finance",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        2032
      ]
    },
    {
      "id": "19233ac1-848d-4d3b-abca-4022f3ffa17c",
      "name": "Shopping",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1152,
        2176
      ]
    },
    {
      "id": "99b15563-82da-4321-8ff0-60c21861f764",
      "name": "travel",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        2288
      ]
    },
    {
      "id": "bfa96076-0b6f-4c39-8f75-e2e6312d2831",
      "name": "Newsletters",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        2464
      ]
    },
    {
      "id": "2f2937a3-22b8-4a71-920d-1393056eee25",
      "name": "Others",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        2656
      ]
    },
    {
      "id": "bf124f1b-0167-479c-a91f-0d759f3f7e60",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -496,
        1792
      ]
    },
    {
      "id": "3adb0acd-3a61-451b-b93a-bebf60b9c213",
      "name": "Get many messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -256,
        1792
      ]
    },
    {
      "id": "12bd7049-1364-4339-af20-f50a765fda3b",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        544,
        2032
      ]
    },
    {
      "id": "84d8bff0-4363-4fd1-b830-68c23952d7d0",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        288,
        2032
      ]
    }
  ],
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Work",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Personal",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Finance",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Shopping",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "travel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Newsletters",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Others",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages": {
      "main": [
        [
          {
            "node": "Label Checker Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Give a Label AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Label Checker Filter": {
      "main": [
        [
          {
            "node": "Give a Label AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Give a Label AI Agent": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Give a Label AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get many messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}