Templates / Automatic Gmail message categorization with GPT-4 content analysis & labels

Automatic Gmail message categorization with GPT-4 content analysis & labels

Ready for 3.0

by Henry ✓ · 1,165 views · created 2025-06-05 · 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 11 nodes and runs on Gmail events. Along the way it connects Gmail and OpenAI Chat Model.

How it runs

Trigger: On Gmail events.

  1. Get message content (Gmail): get
  2. Assign labels for message (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI GPT-4 Based; output parser: JSON Parser
  3. Set label values (Edit Fields (Set)): sets 1 field: labels
  4. Split Out: splits a list into separate items
  5. Get all labels (Gmail): work with label
  6. Merge: merges the data from its input branches
  7. Aggregate: combines items into one
  8. Add labels to message (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) (Gmail trigger).

Nodes used (9)

From the author

Who is this for? This workflow is ideal for Gmail users and teams who receive a high volume of emails and want to streamline inbox management. It suits professionals seeking to organize messages automatically, including sales teams, project managers, support…

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