{
  "name": "Filter and label Gmail emails using keyword-based rules and Google Sheets logging",
  "nodes": [
    {
      "id": "03449484-6387-4f40-9af0-c8c0bdf1822e",
      "name": "Extract Email Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -656,
        112
      ]
    },
    {
      "id": "179d0ac6-8492-43e5-834b-cf5c0439a739",
      "name": "Analyze Email Content",
      "type": "n8n-nodes-base.code",
      "position": [
        -448,
        112
      ]
    },
    {
      "id": "a1a5a7ed-c90b-4f75-8d1a-3ea78372cc20",
      "name": "Label as Outreach",
      "type": "n8n-nodes-base.gmail",
      "position": [
        0,
        0
      ]
    },
    {
      "id": "bc8a106d-300b-44b7-b8bd-219c9b0bf26c",
      "name": "Remove from Inbox",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        0
      ]
    },
    {
      "id": "cacc4443-e5ab-4ff6-96f8-b17283bd711a",
      "name": "Mark as Read",
      "type": "n8n-nodes-base.gmail",
      "position": [
        448,
        0
      ]
    },
    {
      "id": "d21174b5-d5c4-44f6-85a4-f6b5b08ca357",
      "name": "Check if Marketing",
      "type": "n8n-nodes-base.if",
      "position": [
        64,
        544
      ]
    },
    {
      "id": "c2bc918a-73f4-479e-9f21-a648b8631819",
      "name": "Label as Legitimate",
      "type": "n8n-nodes-base.gmail",
      "position": [
        352,
        720
      ]
    },
    {
      "id": "801a1be0-171e-4304-886c-dc8ed2f4f39e",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1056,
        112
      ]
    },
    {
      "id": "b0e4bdb8-cb9f-49f9-a2c9-32135c4c7183",
      "name": "Get a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -864,
        112
      ]
    },
    {
      "id": "1e1eb89b-aa0c-4939-ad4f-713059830b29",
      "name": "Check if Needs_review",
      "type": "n8n-nodes-base.if",
      "position": [
        -176,
        368
      ]
    },
    {
      "id": "11c3f86c-03ca-47af-9b85-7e05459eedce",
      "name": "Label as Needs Review",
      "type": "n8n-nodes-base.gmail",
      "position": [
        80,
        304
      ]
    },
    {
      "id": "ed1ec15e-5d31-4a00-a463-1fef1245df25",
      "name": "Check If Cold Outreach",
      "type": "n8n-nodes-base.if",
      "position": [
        -224,
        112
      ]
    },
    {
      "id": "0fc883f1-ed7b-432d-9aab-7848ad84594b",
      "name": "Edit Fields (outreach)",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        0
      ]
    },
    {
      "id": "6f7e573d-0043-4a27-8ee1-0496bbf2f0d7",
      "name": "Edit Fields (needs review)",
      "type": "n8n-nodes-base.set",
      "position": [
        320,
        272
      ]
    },
    {
      "id": "d1c83d0c-7eb0-43c5-a860-ebd331d9e3ee",
      "name": "Edit Fields (marketing)",
      "type": "n8n-nodes-base.set",
      "position": [
        624,
        464
      ]
    },
    {
      "id": "527fdc6f-c77c-4a3f-9081-fecff667b793",
      "name": "Edit Fields (Legitimate)",
      "type": "n8n-nodes-base.set",
      "position": [
        624,
        720
      ]
    },
    {
      "id": "99d3da05-070a-4caa-9403-42f726c87c21",
      "name": "Log to Spreadsheet (outreach)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        912,
        0
      ]
    },
    {
      "id": "57b7a58a-ba34-414d-bc06-19a7c95ffad6",
      "name": "Log to Spreadsheet (needs review)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        592,
        272
      ]
    },
    {
      "id": "246b4c41-7b53-4d7e-8f98-9bc4ae495f38",
      "name": "Log to Spreadsheet (legitimate)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        720
      ]
    },
    {
      "id": "943c3f79-eab1-404c-b0a5-dd4445a12406",
      "name": "Log to Spreadsheet (marketing/Ads)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        464
      ]
    },
    {
      "id": "41d96057-e17e-4327-9454-4c8cbaef6c18",
      "name": "Label as Marketing/Ads",
      "type": "n8n-nodes-base.gmail",
      "position": [
        368,
        464
      ]
    },
    {
      "id": "33d7e260-454d-4b28-8b63-c0185c711362",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        -480
      ],
      "parameters": {
        "width": 400,
        "height": 832,
        "content": "## Workflow Overview +Gmail Setup\n\nThis workflow automatically filters incoming Gmail emails using keyword detection.\n\nThe workflow analyzes the email subject and snippet to determine whether the emai"
      }
    },
    {
      "id": "7f900928-7caf-4852-8e0f-e3ffc10b2b02",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -432
      ],
      "parameters": {
        "width": 576,
        "height": 768,
        "content": "## Email Data Extraction and Analyze\n\nThese nodes retrieve the full Gmail message and analyze them.\n\nThe workflow extracts useful fields such as:\n\n• Sender email\n• Subject line\n• Email snippet\n• Times"
      }
    },
    {
      "id": "bf5395cc-46e7-4543-bb39-0f5ef4c02722",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        544
      ],
      "parameters": {
        "width": 576,
        "height": 400,
        "content": "## Keyword Filtering Logic\n\nThis section checks the email subject and snippet for keywords commonly associated with:\n\nCold outreach:\nsales outreach, partnership opportunity, quick call, growth strateg"
      }
    },
    {
      "id": "815d3736-f471-4d50-a83c-baded65a371f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        -96
      ],
      "parameters": {
        "width": 576,
        "height": 544,
        "content": "##Email Actions and Optional Logging\n\nAfter classification, the workflow applies the appropriate Gmail label.\n\nActions performed:\n\n• Apply the label (Cold Outreach / Marketing / Needs Review / Legitim"
      }
    }
  ],
  "connections": {
    "Mark as Read": {
      "main": [
        [
          {
            "node": "Edit Fields (outreach)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a message": {
      "main": [
        [
          {
            "node": "Extract Email Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Get a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Label as Outreach": {
      "main": [
        [
          {
            "node": "Remove from Inbox",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove from Inbox": {
      "main": [
        [
          {
            "node": "Mark as Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Marketing": {
      "main": [
        [
          {
            "node": "Label as Marketing/Ads",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label as Legitimate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Email Data": {
      "main": [
        [
          {
            "node": "Analyze Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Label as Legitimate": {
      "main": [
        [
          {
            "node": "Edit Fields (Legitimate)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Email Content": {
      "main": [
        [
          {
            "node": "Check If Cold Outreach",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Needs_review": {
      "main": [
        [
          {
            "node": "Label as Needs Review",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check if Marketing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Label as Needs Review": {
      "main": [
        [
          {
            "node": "Edit Fields (needs review)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Cold Outreach": {
      "main": [
        [
          {
            "node": "Label as Outreach",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check if Needs_review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields (outreach)": {
      "main": [
        [
          {
            "node": "Log to Spreadsheet (outreach)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Label as Marketing/Ads": {
      "main": [
        [
          {
            "node": "Edit Fields (marketing)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields (marketing)": {
      "main": [
        [
          {
            "node": "Log to Spreadsheet (marketing/Ads)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields (Legitimate)": {
      "main": [
        [
          {
            "node": "Log to Spreadsheet (legitimate)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields (needs review)": {
      "main": [
        [
          {
            "node": "Log to Spreadsheet (needs review)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}