Multi-account email classifier with AI, Gmail, Discord & Google Sheets
Ready for 3.0What this workflow does
This AI workflow has 22 nodes and runs on Gmail events (plus 4 other triggers). Along the way it connects Gmail, OpenAI Chat Model, Google Sheets and Discord.
How it runs
Trigger: On Gmail events (plus 4 other triggers).
- medium (Edit Fields (Set)): sets 2 fields: discord_channel, email
- Merge: merges the data from its input branches
- medium (Edit Fields (Set)): sets 2 fields: discord_channel, email
- medium (Edit Fields (Set)): sets 2 fields: discord_channel, email
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; 3 tools (Get spam list, update spam list, Get a message in Discord)
- medium (Edit Fields (Set)): sets 2 fields: discord_channel, email
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; 1 tool (Get spam list); output parser: Structured Output Parser
- Discord: work with message
- If: checks a condition and branches into true / false
- Send a message (Discord): work with message
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, Gmail Trigger1, Gmail Trigger2).
Nodes used (11)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Merge
n8n-nodes-base.merge - Edit Fields (Set)
n8n-nodes-base.set - Webhook
n8n-nodes-base.webhook - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Google Sheets Tool
n8n-nodes-base.googleSheetsTool - Discord
n8n-nodes-base.discord - Discord Tool
n8n-nodes-base.discordTool - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - If
n8n-nodes-base.if
From the author
AI Email Classifier 📬 Automate Email Classification, Prioritization, and Spam Detection Across Multiple Accounts Created by: Jayant Kumar (@jharilela) 🛠 Powered by: Gmail, Google Sheets, OpenAI, Discord, and n8n --- Sample Discord labelling as Spam Sample…