{
  "name": "Email management: Auto-delete marketing emails & generate AI replies with Gemini",
  "nodes": [
    {
      "id": "804be255-fa04-4da2-ade7-720815a54719",
      "name": "Delete a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        480,
        272
      ]
    },
    {
      "id": "168d8523-8167-4365-8f86-3114f48f0887",
      "name": "Reply to a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        480,
        464
      ]
    },
    {
      "id": "12a25055-b776-4203-a65e-2adc405b6187",
      "name": "Get many messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -592,
        272
      ]
    },
    {
      "id": "7b4c77aa-0d4d-4f94-89f2-c546a689a8c8",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        752,
        528
      ]
    },
    {
      "id": "c4a2506f-c0eb-4e0c-9187-c256c104f596",
      "name": "Append or update row in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        912,
        384
      ]
    },
    {
      "id": "60b53d94-5748-486a-a559-e70f4e125756",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -816,
        272
      ]
    },
    {
      "id": "27d393ea-46fc-4d25-828f-440043864122",
      "name": "Email Trigger (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -672,
        592
      ]
    },
    {
      "id": "7b65f16d-3908-4b04-a151-65eef73d7c95",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        16
      ],
      "parameters": {
        "width": 400,
        "height": 448,
        "content": "# 🚀 Gemini Model Tasks\n## 📌 Objectives:\n\n- 🕵️‍♂️ Detect if an incoming email is a marketing email\n\n- 🏷️ If yes → Add a classification flag like isMarketing: true ✅\n\n- ✉️ If not a marketing email → Pre"
      }
    },
    {
      "id": "7cbe344e-e0b7-4e77-9878-42ac28240de6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        464
      ],
      "parameters": {
        "width": 544,
        "height": 224,
        "content": "# ⏰ Scheduled Trigger\n⚡ Instantly kicks off the workflow whenever a new 📩 email lands in the account – no delays, fully automated! 🤖✨"
      }
    },
    {
      "id": "5a0d1cc4-e3f3-474c-91e8-d8d817c3e434",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 448,
        "height": 464,
        "content": "# 🏷️ Classification of Emails\n\n### 📌 Based on the feature flag present in the response, this node decides whether the email should be:\n\n✉️ Replied to → Sent to the Reply Workflow 🔁\n\n🗑️ Deleted → Sent "
      }
    },
    {
      "id": "526fe4b0-c5d5-4722-8f2a-50dc312da798",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        32
      ],
      "parameters": {
        "width": 496,
        "height": 688,
        "content": "# 📊 Tracking\n\n## 🛑 This is the final step of the workflow where all actioned emails are recorded.\n🗂️ It keeps track of:\n\n🗑️ Deleted emails\n\n✉️ Replied emails, along with their 📌 email subjects\n\n🔍 Usef"
      }
    },
    {
      "id": "f412f452-5f84-49e6-b0a6-d3e06ab1600d",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        -368,
        368
      ]
    },
    {
      "id": "cbb4bf93-536b-47ea-852d-2dfd4fbe24a5",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        160
      ],
      "parameters": {
        "width": 560,
        "height": 256,
        "content": "# 🖐️ Manual Trigger\n⚡ Triggered based on user actions – the workflow starts when the user decides to take action 🧠🕹️"
      }
    },
    {
      "id": "e814bd89-2f16-47f4-8765-2daa40d728cb",
      "name": "AI response formatter",
      "type": "n8n-nodes-base.set",
      "position": [
        32,
        368
      ]
    },
    {
      "id": "2ebd1e06-a096-4283-bfb9-d9cf260c3441",
      "name": "categories emails",
      "type": "n8n-nodes-base.switch",
      "position": [
        256,
        368
      ]
    }
  ],
  "connections": {
    "Message a model": {
      "main": [
        [
          {
            "node": "AI response formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete a message": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "categories emails": {
      "main": [
        [
          {
            "node": "Delete a message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reply to a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply to a message": {
      "main": [
        [
          {
            "node": "Append or update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI response formatter": {
      "main": [
        [
          {
            "node": "categories emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get many messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}