Skip to main content

Categorise and label Gmail emails with GPT-4o and OpenAI

Workflow preview

Workflow preview
100%
Categorise and label Gmail emails with GPT-4o and OpenAI preview
Open on n8n.io

1. Workflow Overview

Automatically organise your Gmail inbox using AI. This workflow categorises every incoming email and applies Gmail labels, keeping only important emails in your inbox while filing everything else a...

Best for

  • Ticket Management automation workflows
  • AI Summarization automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.openai, n8n-nodes-base.filter, n8n-nodes-base.gmail, n8n-nodes-base.gmailtrigger, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Zac Nielsen.

Original n8n.io source

1.1 Workflow description

Title
Categorise and label Gmail emails with GPT-4o and OpenAI
Workflow name
Categorise and label Gmail emails with GPT-4o and OpenAI

Automatically organise your Gmail inbox using AI. This workflow categorises every incoming email and applies Gmail labels, keeping only important emails in your inbox while filing everything else automatically.

Who is this for? Anyone overwhelmed by email clutter who wants inbox zero without manual sorting.

How it works

  1. Gmail Trigger polls your inbox for new emails every minute
  2. AI Categorisation (GPT-4o) analyses each email and assigns a category such as Action Required, Newsletters, Sales Pitches, Client Communication, Receipts, and more
  3. Filter checks if the email requires your attention or can be auto-filed
  4. Label Management removes non-actionable emails from inbox and applies the appropriate Gmail label

Prerequisites

  • Gmail account with OAuth2 access
  • OpenAI API key
  • Gmail labels created for each category you want to use

Setup steps

  1. Import the workflow and connect your Gmail OAuth2 credentials
  2. Add your OpenAI API key
  3. Create Gmail labels matching your categories such as Action Required, Newsletters, People Selling Me Stuff, Admin/Receipts
  4. Run the Get many labels node manually to retrieve your label IDs
  5. Update the Add to folder node with your label ID mapping using the example in the pink sticky note
  6. Customise the AI prompt categories to match your workflow needs
  7. Test with a few emails before activating

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Categorize Email

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 2 - Not Worthwhile

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 3 - Get Email

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 4 - Add to folder

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 5 - Remove from Inbox

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 6 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.3

Block 7 - Get many labels

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.2

Block 8 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Categorise and label Gmail emails with GPT-4o and OpenAI
Complexity intermediate
Nodes 12
Categories Ticket Management, AI Summarization
Author Zac Nielsen
Published 05 Feb 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13221/13221.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Categorise and label Gmail emails with GPT-4o and OpenAI do?

Automatically organise your Gmail inbox using AI. This workflow categorises every incoming email and applies Gmail labels, keeping only important emails in your inbox while filing everything else a...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Ticket Management, AI Summarization use case.