AutomationFlowsEmail & Gmail › Get messages with a certain label, remove the label, and add a new one

Get messages with a certain label, remove the label, and add a new one

Get messages with a certain label, remove the label, and add a new one. Uses manualTrigger, gmail. Event-driven trigger; 4 nodes.

Event trigger★★☆☆☆ complexity4 nodesGmail
Email & Gmail Trigger: Event Nodes: 4 Complexity: ★★☆☆☆

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "175",
  "name": "Get messages with a certain label, remove the label, and add a new one",
  "nodes": [
    {
      "name": "On clicking 'execute'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        250,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        450,
        300
      ],
      "parameters": {
        "resource": "message",
        "operation": "getAll",
        "additionalFields": {
          "format": "full",
          "labelIds": [
            "Label_103811885290186237"
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": "<your credential>"
      },
      "typeVersion": 1
    },
    {
      "name": "Gmail1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        650,
        300
      ],
      "parameters": {
        "labelIds": [
          "Label_103811885290186237"
        ],
        "resource": "messageLabel",
        "messageId": "={{$node[\"Gmail\"].json[\"id\"]}}",
        "operation": "remove"
      },
      "credentials": {
        "gmailOAuth2": "<your credential>"
      },
      "typeVersion": 1
    },
    {
      "name": "Gmail2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        850,
        300
      ],
      "parameters": {
        "labelIds": [
          "Label_140673791182006844"
        ],
        "resource": "messageLabel",
        "messageId": "={{$node[\"Gmail\"].json[\"id\"]}}"
      },
      "credentials": {
        "gmailOAuth2": "<your credential>"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {},
  "connections": {
    "Gmail": {
      "main": [
        [
          {
            "node": "Gmail1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail1": {
      "main": [
        [
          {
            "node": "Gmail2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

About this workflow

Get messages with a certain label, remove the label, and add a new one. Uses manualTrigger, gmail. Event-driven trigger; 4 nodes.

Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →