Route and categorize Gmail emails to Slack with Llama 3 via OpenRouter
Ready for 3.0What this workflow does
This AI workflow has 18 nodes and runs on Gmail events. Along the way it connects Slack, OpenRouter Chat Model and Gmail.
How it runs
Trigger: On Gmail events.
- Filter + Deduplicate Validation (Code): runs custom JavaScript code
- Check Data Exist (If): checks a condition and branches into true / false
- Arrange Email Data (Edit Fields (Set)): sets or maps fields
- Find Category (AI Agent): runs an AI agent, with model: OpenRouter Chat Model; output parser: Structured Output Parser
- Merge Category (Edit Fields (Set)): sets 9 fields: output.category, id, text…
- Get Channels List (Slack): get many (channel)
- Format Channel Data (Code): runs custom JavaScript code
- Remove Duplicate Channel + Find Matched Channel (Code): runs custom JavaScript code
- Check Channel Exist (If): checks a condition and branches into true / false
- Join Slack Channel (Slack): join (channel)
…plus 4 more steps. See the full node list below.
Services it uses
Other Gmail + Slack templates (957) · Other Gmail + OpenRouter templates (135) · Other Slack + OpenRouter templates (73)
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) (Capture Gmail Event).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (8)
- Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Edit Fields (Set)
n8n-nodes-base.set - Slack
n8n-nodes-base.slack - AI Agent
@n8n/n8n-nodes-langchain.agent - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter - Gmail Trigger
n8n-nodes-base.gmailTrigger
From the author
Quick overview This n8n template provides a complete and automated solution to transform your team’s inbox management. It acts as an intelligent agent that reads incoming Gmail messages, uses AI to determine their category, and automatically routes them to…