{
  "name": "AI email organizer for GMail - advanced email management & sorting",
  "nodes": [
    {
      "id": "fd08b5e1-f370-46b6-8088-c2e59c73d71c",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ]
    },
    {
      "id": "78f01440-ef12-4ee6-a9a5-af4d39104c0c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        -140
      ],
      "parameters": {
        "width": 420,
        "height": null,
        "content": "## 1 - Config\n\n1) [G Sheets to Duplicate](https://docs.google.com/spreadsheets/d/1LKIx1Z3dCSX1uzyZH9s2HE0QRMvLTDI6sJApFU5LTj0/edit?gid=0#gid=0)\n2) To edit: File -> Make a copy\n2) Copy the URL of your "
      }
    },
    {
      "id": "58417d60-eaaf-4d3f-affb-3a1655d2777b",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "position": [
        220,
        0
      ]
    },
    {
      "id": "8f8812bc-dc04-4405-8d33-e6d457e2d1e8",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        880,
        0
      ]
    },
    {
      "id": "e1bf4a15-a2b5-48a4-83d4-af649f20101f",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        880,
        220
      ]
    },
    {
      "id": "5c597cd5-69f0-42ac-a158-a5ef766157b0",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        20
      ],
      "parameters": {
        "width": 420,
        "height": 400,
        "content": "## 2 - Connect AI (Optional: find free model)\n\n1) Get OpenRouter API Key: https://openrouter.ai/settings/keys\n\n2) [List of currently free models](https://openrouter.ai/models?max_price=0&order=top-wee"
      }
    },
    {
      "id": "8ec93dff-52a4-410e-b45f-f492bcc0bb88",
      "name": "Get Labels",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        440,
        0
      ]
    },
    {
      "id": "221de31a-e662-402d-8795-1bcd40757855",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        -220
      ],
      "parameters": {
        "width": null,
        "height": 80,
        "content": "# Setup"
      }
    },
    {
      "id": "e41fb3ca-5de0-4a1a-a0f7-4f6fddc739ed",
      "name": "Create Label if Doesn't exist",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1620,
        280
      ]
    },
    {
      "id": "fea8a543-0bb4-460e-9862-06c711ec30e6",
      "name": "Get Existing Labels",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1820,
        280
      ]
    },
    {
      "id": "a45806ca-6b98-411a-a8b2-a8b9f071d6c0",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1460,
        0
      ]
    },
    {
      "id": "de31842d-88de-4281-a8f7-5e88db026ece",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        2020,
        280
      ]
    },
    {
      "id": "fe0c9d60-bd76-4a72-adb4-0b04bcd971bc",
      "name": "Gmail1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2200,
        280
      ]
    },
    {
      "id": "3f3c2627-c20d-443f-8a6f-c803139c4143",
      "name": "Fields For Loop",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        0
      ]
    },
    {
      "id": "10ede08e-bdbc-4c3f-8c25-2724bfbda6f5",
      "name": "Get Messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        660,
        0
      ]
    },
    {
      "id": "f15bda54-5a37-49e1-b06c-322308689c6e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        160
      ],
      "parameters": {
        "width": 310,
        "height": null,
        "content": "👆⬆️\n1 - sheets_url - Where the category definitions live\n2 - extra_filter - Leave empty to process all emails. Use any gmail search filters.\n3 - limit - max no. of emails to process in a run"
      }
    },
    {
      "id": "e989c10d-8dc7-4c88-b1ee-173147a5e8b2",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -580
      ],
      "parameters": {
        "width": 640,
        "height": 440,
        "content": "# Contact Us:\n## Milan @ SmoothWork - [Book a Free Consulting Call](https://smoothwork.ai/book-a-call/)\n![Milan](https://gravatar.com/avatar/95700d17ba300a9f14c1b8cacf933df7720027b3adda9cbe6183d891429"
      }
    },
    {
      "id": "192f7006-51f9-44cb-aabb-d7c751e8d911",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        -580
      ],
      "parameters": {
        "width": 420,
        "height": 340,
        "content": "# Video Walkthrough\n[![image.png](https://n8niostorageaccount.blob.core.windows.net/n8nio-strapi-blobs-prod/assets/Screenshot_2025_07_09_112813_949f1ca667.png)](https://www.youtube.com/watch?v=BQARyWM"
      }
    }
  ],
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Get Labels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Gmail1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Fields For Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Labels": {
      "main": [
        [
          {
            "node": "Get Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Messages": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fields For Loop": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Create Label if Doesn't exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Labels": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create Label if Doesn't exist": {
      "main": [
        [
          {
            "node": "Get Existing Labels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}