Templates / Sort Gmail leads, meetings, and trash with OpenAI classification

Sort Gmail leads, meetings, and trash with OpenAI classification

Ready for 3.0

by Marc Soummer ✓ · 25 views · created 2026-07-19 · 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 16 nodes and runs on Gmail events. Along the way it connects Gmail and OpenAI.

How it runs

Trigger: On Gmail events.

  1. Fetch Full Email Message (Gmail): get
  2. Execute Pre-Classify Rules (Code): runs custom JavaScript code
  3. Route by Pre-Classification (Switch): routes items into 5 branches
  4. Label as Team (Gmail): add labels
  5. Label as Meetings (Gmail): add labels
  6. OpenAI: uses OpenAI
  7. Calculate Deletion Time (Code): runs custom JavaScript code
  8. Parse Classification Result (Code): runs custom JavaScript code
  9. Label Pending Deletion (Gmail): add labels
  10. Route by LLM Classification (Switch): routes items into 3 branches

…plus 4 more steps. See the full node list below.

Services it uses

GmailOpenAI

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 Received1).

Nodes used (7)

From the author

Quick Overview This workflow monitors Gmail for new messages, applies rule-based pre-classification, and uses OpenAI to categorize ambiguous emails as lead, review, or trash, then applies Gmail labels and schedules automatic deletion for trash threads. How it…

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