Automated Gmail classification and labeling with GPT-4, Sheets and Slack alerts
Ready for 3.0What this workflow does
This AI workflow has 21 nodes and runs on Gmail events. Along the way it connects OpenAI Chat Model, Gmail, Google Sheets and Slack.
How it runs
Trigger: On Gmail events.
- Extract and Clean Email Content (Code): runs custom JavaScript code
- Classify and Extract Entities (AI Agent): runs an AI agent, with model: OpenAI Chat Model; output parser: Structured Output Parser
- Parse and Validate AI Response (Code): runs custom JavaScript code
- Check Classification Success (If): checks a condition and branches into true / false
- Check if High Priority or Urgent (If): checks a condition and branches into true / false
- Route by Category (Switch): routes items into 9 branches
- Log Classification Errors (Google Sheets): append or update
- Send Urgent Email Alert (Slack): uses Slack
- Label: Inquiry (Gmail): add labels
- Label: Support Request (Gmail): add labels
…plus 8 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 Check Every 2 Min).
Nodes used (10)
- Code
n8n-nodes-base.code - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - AI Agent
@n8n/n8n-nodes-langchain.agent - If
n8n-nodes-base.if - Switch
n8n-nodes-base.switch - Gmail
n8n-nodes-base.gmail - Google Sheets
n8n-nodes-base.googleSheets - Slack
n8n-nodes-base.slack - Gmail Trigger
n8n-nodes-base.gmailTrigger
From the author
This n8n template automates email labeling using AI-enhanced classification and intelligent routing Gmail users report spending significant time manually sorting email, so this tool helps alleviate that burden. How it works - Gmail Trigger monitors unread…