Templates / Categorize and label existing Gmail emails automatically with GPT-4o mini

Categorize and label existing Gmail emails automatically with GPT-4o mini

Needs changes

by Arlin Perez ✓ · 3,825 views · created 2025-07-15 · Personal Productivity, AI Summarization

Needs changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 14 nodes and runs manually, when you click “Execute workflow”. Along the way it connects Gmail and OpenAI Chat Model.

How it runs

Trigger: Manually, when you click “Execute workflow”.

  1. Get many messages (Gmail): get many
  2. Label Checker Filter (Filter): keeps only the items that match a condition
  3. Give a Label AI Agent (AI Agent): runs an AI agent, with model: OpenAI Chat Model; output parser: Structured Output Parser
  4. Switch: routes items into 7 branches
  5. Work (Gmail): add labels
  6. Personal (Gmail): add labels
  7. Finance (Gmail): add labels
  8. Shopping (Gmail): add labels
  9. travel (Gmail): add labels
  10. Newsletters (Gmail): add labels

…plus 1 more step. See the full node list below.

Services it uses

GmailOpenAI Chat Model

Before you upgrade to n8n 3.0

1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:

  • AI Agent v1 (old agent modes) in Give a Label AI Agent (v1.8): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).

Removed in 3.0Replace with
AI Agent v1 (old agent modes)
Give a Label AI Agent (v1.8)
Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Nodes used (7)

From the author

📨 Categorize and Label Existing Gmail Emails Automatically with GPT-4o mini 👥 Who's it for This workflow is perfect for individuals or teams who want to sort and label existing emails in their Gmail inbox 🗃️ using AI. Ideal for cleaning up unlabeled emails…

Excerpt from Arlin Perez's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.