AutomationFlowsGeneral › Fetch Gmail Label IDs Once

Fetch Gmail Label IDs Once

Original n8n title: Get Label Ids - Run Once

Get Label IDs - Run Once. Uses httpRequest. Event-driven trigger; 3 nodes.

Event trigger★★★★☆ complexity3 nodesHTTP Request
General Trigger: Event Nodes: 3 Complexity: ★★★★☆ Added:

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
{
  "name": "Get Label IDs - Run Once",
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [],
  "nodes": [
    {
      "id": "h001",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        200,
        300
      ],
      "parameters": {}
    },
    {
      "id": "h002",
      "name": "Fetch Label IDs",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        450,
        300
      ],
      "credentials": {
        "oAuth2Api": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "url": "https://gmail.googleapis.com/gmail/v1/users/me/labels",
        "authentication": "oAuth2",
        "options": {}
      }
    },
    {
      "id": "h003",
      "name": "Show Custom Labels Only",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        700,
        300
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const resp = $input.first().json;\nconst labels = resp.labels || [];\n// Only show user-created labels (not system ones like INBOX, UNREAD)\nconst custom = labels.filter(l => l.type === 'user');\nreturn custom.map(l => ({ json: { name: l.name, id: l.id } }));\n"
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Fetch Label IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Label IDs": {
      "main": [
        [
          {
            "node": "Show Custom Labels Only",
            "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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Get Label IDs - Run Once. Uses httpRequest. Event-driven trigger; 3 nodes.

Source: https://github.com/odeliyach/CareerOS/blob/ab23d0ee28a9911877fffa68ae96cbcd6978270f/n8n-workflows/helper-get-label-ids.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Kv Cloudflare Key Value Database Full Api Integration Workflow. Uses stickyNote, httpRequest, manualTrigger. Event-driven trigger; 47 nodes.

HTTP Request
General

Reputation Engine — Site Refresh. Uses httpRequest, executeWorkflowTrigger. Event-driven trigger; 35 nodes.

HTTP Request, Execute Workflow Trigger
General

Reputation Engine — Content Generator. Uses httpRequest. Event-driven trigger; 30 nodes.

HTTP Request
General

PRECALL. Uses executeWorkflowTrigger, httpRequest. Event-driven trigger; 23 nodes.

Execute Workflow Trigger, HTTP Request
General

Blog Post → Social Media. Uses rssFeedTrigger, httpRequest. Event-driven trigger; 22 nodes.

Rss Feed Trigger, HTTP Request