Templates / Label incoming Gmail emails with GPT-5 and Gmail labels

Label incoming Gmail emails with GPT-5 and Gmail labels

Ready for 3.0

by Thomas Abraham ✓ · 45 views · created 2026-07-25 · Ticket Management, AI Summarization

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 6 nodes and runs on Gmail events. Along the way it connects Gmail and OpenAI Chat Model.

How it runs

Trigger: On Gmail events.

  1. Set Label Taxonomy (Edit Fields (Set)): sets 7 fields: CategoryList, Sales_LabelId, Support_LabelId…
  2. AI Email Classifier (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI GPT-5 Mini Model
  3. Map Category to Gmail Label (Code): runs custom JavaScript code
  4. Apply Label in Gmail (Gmail): add labels

Services it uses

GmailOpenAI Chat Model

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

  • Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (When Email Received in Gmail).

Nodes used (6)

From the author

Quick overview This workflow watches for new Gmail messages, uses OpenAI to classify each email into a category, maps that category to a Gmail label ID, and then applies the matching label to the message automatically. How it works 1. Triggers every minute…

Excerpt from Thomas Abraham'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.