Auto-label Gmail with Ollama AI and draft smart replies
Ready for 3.0Ready 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, Google Sheets and Ollama Chat Model.
How it runs
Trigger: On Gmail events.
- 🔧 Extract Email Data (Code): runs custom JavaScript code
- 🤖 AI Email Classifier (AI Agent): runs an AI agent, with model: Ollama Chat Model
- 🎯 Extract Classification (Code): runs custom JavaScript code
- 🔀 Route by Category (Switch): routes items into 6 branches
- 🏷️ Label: Urgent (Gmail): add labels
- 🏷️ Label: Action Required (Gmail): add labels
- 🏷️ Label: Follow-up (Gmail): add labels
- 🏷️ Label: Newsletter (Gmail): add labels
- 🏷️ Label: Automated (Gmail): add labels
- 🏷️ Label: Spam-Promo (Gmail): add labels
…plus 4 more steps. See the full node list below.
Services it uses
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 (7)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Code
n8n-nodes-base.code - AI Agent
@n8n/n8n-nodes-langchain.agent - Switch
n8n-nodes-base.switch - Gmail
n8n-nodes-base.gmail - Google Sheets
n8n-nodes-base.googleSheets - Ollama Chat Model
@n8n/n8n-nodes-langchain.lmChatOllama
From the author
Who is this for This workflow is built for professionals, founders, freelancers, and anyone drowning in email who wants to automatically triage their inbox using AI — sorting emails into categories, applying Gmail labels, and generating reply drafts for…