Gmail + Slack: smarter triage, faster replies
Your inbox is doing two jobs at once. It’s receiving messages and acting like a ticketing system, which is why important emails get buried and “quick replies” turn into a whole afternoon.
Marketing managers feel it when leads sit too long. Support leads feel it when complaints get missed. And if you run a small team, you’re the one double-checking everything. This Gmail Slack triage automation routes messages to the right owner and keeps response quality consistent without living in your inbox.
You’ll see how this workflow classifies new emails, uses lightweight AI only when needed, and posts clear Slack alerts so the right person can act fast.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Gmail + Slack: smarter triage, faster replies
flowchart LR
subgraph sg0["Basic LLM Chain Flow"]
direction LR
n0@{ icon: "mdi:message-outline", form: "rounded", label: "Email Trigger (IMAP)", pos: "b", h: 48 }
n1@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Switch1", pos: "b", h: 48 }
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Code"]
n3@{ icon: "mdi:robot", form: "rounded", label: "Basic LLM Chain", pos: "b", h: 48 }
n4@{ icon: "mdi:brain", form: "rounded", label: "Groq Chat Model", pos: "b", h: 48 }
n5@{ icon: "mdi:brain", form: "rounded", label: "Groq Chat Model1", pos: "b", h: 48 }
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/x.dark.svg' width='40' height='40' /></div><br/>X"]
n7@{ icon: "mdi:brain", form: "rounded", label: "Groq Chat Model2", pos: "b", h: 48 }
n8@{ icon: "mdi:robot", form: "rounded", label: "Basic LLM Chain1", pos: "b", h: 48 }
n9@{ icon: "mdi:brain", form: "rounded", label: "Groq Chat Model3", pos: "b", h: 48 }
n10["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Code2"]
n11@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Switch", pos: "b", h: 48 }
n12@{ icon: "mdi:cube-outline", form: "rounded", label: "Pinecone Vector Store", pos: "b", h: 48 }
n13@{ icon: "mdi:vector-polygon", form: "rounded", label: "Embeddings Cohere", pos: "b", h: 48 }
n22@{ icon: "mdi:message-outline", form: "rounded", label: "send email to team", pos: "b", h: 48 }
n23@{ icon: "mdi:message-outline", form: "rounded", label: "send reply to customer", pos: "b", h: 48 }
n24@{ icon: "mdi:message-outline", form: "rounded", label: "send to support team", pos: "b", h: 48 }
n25@{ icon: "mdi:message-outline", form: "rounded", label: "Send to customer", pos: "b", h: 48 }
n26@{ icon: "mdi:message-outline", form: "rounded", label: "rejection email", pos: "b", h: 48 }
n27@{ icon: "mdi:message-outline", form: "rounded", label: "to hr", pos: "b", h: 48 }
n28@{ icon: "mdi:message-outline", form: "rounded", label: "accepted confirm to candidate", pos: "b", h: 48 }
n29@{ icon: "mdi:message-outline", form: "rounded", label: "bill send to team", pos: "b", h: 48 }
n30@{ icon: "mdi:message-outline", form: "rounded", label: "TO SALES TEAM", pos: "b", h: 48 }
n31["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>CLEAN AI AGENT OUTPUT"]
n32@{ icon: "mdi:robot", form: "rounded", label: "RAG INQURY REPLY", pos: "b", h: 48 }
n33@{ icon: "mdi:robot", form: "rounded", label: "Sentiment Analysis of feedback", pos: "b", h: 48 }
n2 --> n1
n10 --> n11
n11 --> n28
n11 --> n26
n1 --> n8
n1 --> n29
n1 --> n25
n1 --> n33
n1 --> n32
n1 --> n30
n1 --> n3
n3 --> n31
n4 -.-> n3
n8 --> n10
n5 -.-> n33
n7 -.-> n32
n9 -.-> n8
n32 --> n23
n25 --> n24
n13 -.-> n12
n0 --> n2
n31 --> n1
n12 -.-> n32
n28 --> n27
n33 --> n6
n33 --> n22
end
subgraph sg1["When clicking ‘Execute workflow’ Flow"]
direction LR
n14@{ icon: "mdi:play-circle", form: "rounded", label: "When clicking ‘Execute workf..", pos: "b", h: 48 }
n15["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>HTTP Request"]
n16@{ icon: "mdi:cog", form: "rounded", label: "Extract from File", pos: "b", h: 48 }
n17["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Code3"]
n18@{ icon: "mdi:cube-outline", form: "rounded", label: "Pinecone Vector Store1", pos: "b", h: 48 }
n19@{ icon: "mdi:vector-polygon", form: "rounded", label: "Embeddings Cohere1", pos: "b", h: 48 }
n20@{ icon: "mdi:robot", form: "rounded", label: "Default Data Loader", pos: "b", h: 48 }
n21@{ icon: "mdi:robot", form: "rounded", label: "Recursive Character Text Spl..", pos: "b", h: 48 }
n17 --> n18
n15 --> n16
n16 --> n17
n19 -.-> n18
n20 -.-> n18
n21 -.-> n20
n14 --> n15
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n14 trigger
class n3,n8,n32,n33,n20,n21 ai
class n4,n5,n7,n9 aiModel
class n12,n18 ai
class n13,n19 ai
class n1,n11 decision
class n15 api
class n2,n10,n31,n17 code
classDef customIcon fill:none,stroke:none
class n2,n6,n10,n31,n15,n17 customIcon
Why This Matters: Inbox triage breaks at scale
Handling email “as it comes in” works… until it doesn’t. One complaint lands at 9:05, a billing question at 9:07, a partnership request at 9:10, and suddenly you’re context-switching all morning. You skim, you guess the intent, you forward to someone, then you remember you never replied to the sender. The worst part is the mental load: you’re constantly wondering what you missed, not just what you answered.
It adds up fast. Here’s where it usually breaks down in real teams.
- Messages get routed based on who happened to see them first, not who should own them.
- Complaints and high-sentiment emails hide in the same inbox view as newsletters and vendor updates.
- Reply quality drifts because everyone writes differently, especially under pressure.
- Forwarding and “FYI” threads happen in email, so there’s no clean Slack trail for follow-up.
What You’ll Build: Email classification that routes to Slack (and replies)
This workflow watches your inbox for new messages using an IMAP email trigger, then pulls out the useful bits (sender, subject, and body) so the automation can make a decision quickly. First, it tries simple logic and lightweight classification to route obvious cases like billing, feedback, HR, sales inquiries, or complaints. When the email is ambiguous, it calls an LLM step to “guess” a category, normalizes that guess into a reliable label, and sends it back through the router so the right path runs. For inquiries, it can even use a retrieval step (optional Pinecone memory) to draft a helpful reply that matches your saved knowledge. The end result: the right team gets alerted, the sender gets an appropriate response, and you stop treating your inbox like a messy help desk.
The workflow starts the moment a new email hits your mailbox. It classifies and evaluates sentiment, then routes to outcomes like “notify sales,” “confirm complaint receipt,” or “send inquiry reply.” Only the hard-to-classify messages get AI help, which keeps costs and latency reasonable.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say your inbox gets about 30 meaningful emails a day (leads, complaints, billing, HR). Manually triaging usually takes maybe 3 minutes each to read, decide, and forward, which is about 90 minutes daily before anyone even starts real work. With this workflow, classification and routing happen automatically after the email arrives, and you only spend time on the messages that truly need a human. For most teams, that’s roughly an hour back per day, plus faster first responses.
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- IMAP-compatible email account to detect new incoming emails.
- Slack to alert the right owner or channel.
- OpenAI-compatible LLM credentials (get it from your LLM provider’s API keys page).
Skill level: Beginner. You’ll connect accounts, paste in a couple of prompts, and test with real emails.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
A new email arrives in your mailbox. The IMAP listener triggers instantly when a message is received, then grabs the subject and body so the workflow can evaluate intent.
The workflow tries to classify it cheaply first. A small script and routing logic handle clear cases (billing, HR, sales, complaints, feedback) so you’re not paying for AI on every single email.
Ambiguous messages get an AI “second opinion.” An LLM chain makes a category guess, another small code step normalizes that output into a consistent label, and the email goes back through the same router so the correct branch runs.
Notifications and replies go out automatically. Depending on the category, the workflow sends an email response (like a complaint receipt or inquiry reply) and can alert teams in Slack so the right person owns the follow-up.
You can easily modify the categories and routing rules to match your team’s inbox reality. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Manual Start Trigger
Use the manual trigger to ingest a sample document for Pinecone indexing and validate the file-processing path.
- Add Manual Start Trigger as the entry point and connect it to Download File Request.
- In Download File Request, set URL to
https://www.dropbox.com/scl/fo/p05bb9t8o6ech9d1joj7s/AKJmlI3mlt3O8qSjGbroMLc?rlkey=m1h852ks0y2o1gmdmbk3uda1d&st=pk0pq820&dl=1and ensure Response Format isfile. - Configure Extract PDF Text with Operation set to
pdfand connect it to Clean Extracted Text. - In Clean Extracted Text, keep the JavaScript logic that normalizes whitespace and outputs
cleanedtext. - Connect Clean Extracted Text to Pinecone Upsert Store to index the cleaned document.
Step 2: Connect the Email Ingestion Trigger
Set up the email intake path so new messages are categorized and routed automatically.
- Add IMAP Email Listener and enable Download Attachments set to
true. - Credential Required: Connect your IMAP credentials in IMAP Email Listener.
- Connect IMAP Email Listener to Subject Classifier Script to begin categorization.
⚠️ Common Pitfall: IMAP connections often fail due to missing app passwords or blocked IMAP access—verify your email provider’s IMAP settings before testing.
Step 3: Set Up Category Classification and Fallback AI
This step assigns a category based on subject keywords and falls back to an LLM when needed.
- In Subject Classifier Script, keep Mode set to
runOnceForEachItemand the provided JavaScript for keyword-based categorization. - Configure Category Router rules using expressions like
={{$json["category"]}}and route to outputshr,billing,complaint,feedback,inquiry,sales, andunknown. - Set up LLM Category Guess with the prompt text exactly as shown, including
{{ $json["subject"] }}and{{ $json["body"] }}. - Attach Groq Chat Engine as the language model for LLM Category Guess and set Model to
llama-3.3-70b-versatile. - Credential Required: Connect your Groq credentials in Groq Chat Engine (LLM provider for LLM Category Guess).
- Ensure LLM Category Guess outputs to Normalize AI Category, which returns
unknownfor unexpected categories.
Step 4: Configure HR Screening and Decision Logic
Route HR-related emails through an LLM-based screening decision and notify candidates and HR accordingly.
- In HR Screening Prompt, keep the prompt template and ensure
{{ $json["emailText"] }}is used for candidate content. - Connect Groq HR Engine as the language model for HR Screening Prompt.
- Credential Required: Connect your Groq credentials in Groq HR Engine (LLM provider for HR Screening Prompt).
- In Decision Parser Script, keep the logic that sets
decisionbased on whether the AI response starts withaccept. - Configure Decision Brancher to branch on
={{ $json[decision] }}foracceptandreject. - Confirm Decision Brancher routes to Acceptance to Candidate (and then Notify HR Team) or Send Rejection Notice.
Step 5: Build Inquiry Responses and Feedback Sentiment
Automate responses to inquiries using RAG and analyze feedback sentiment for publishing and alerts.
- Configure RAG Inquiry Responder with the provided prompt and ensure context uses
{{ $json["vectors"].map(v => v.metadata.text).join("\n\n") || "No context available." }}. - Attach Groq Reply Engine as the language model for RAG Inquiry Responder.
- Credential Required: Connect your Groq credentials in Groq Reply Engine (LLM provider for RAG Inquiry Responder).
- Connect Pinecone Retriever Tool as the tool for RAG Inquiry Responder with Tool Name
knowlagebaseand Tool Descriptioncompany dock. - Credential Required: Connect your Pinecone credentials in Pinecone Retriever Tool.
- In Feedback Sentiment Check, set Input Text to
= {{ $json.textPlain }}and ensure categories includePositive, Neutral, Negative. - Attach Groq Sentiment Engine as the language model for Feedback Sentiment Check.
- Credential Required: Connect your Groq credentials in Groq Sentiment Engine (LLM provider for Feedback Sentiment Check).
- Feedback Sentiment Check outputs to both Post to X Feed and Notify Feedback Team in parallel.
Step 6: Configure Pinecone Indexing and Embeddings
Load documents, split them, and embed content for retrieval in the inquiry responder.
- Set Recursive Text Splitter and Default Document Loader to their defaults and ensure they flow into Pinecone Upsert Store via their AI connections.
- In Pinecone Upsert Store, set Mode to
insertand select your Pinecone Index value (e.g.,[YOUR_ID]). - Credential Required: Connect your Pinecone credentials in Pinecone Upsert Store.
- Configure Cohere Multilingual Embed with Model Name
embed-multilingual-v3.0and connect it as the embedding model for Pinecone Upsert Store. - Credential Required: Connect your Cohere credentials in Cohere Multilingual Embed.
- Configure Cohere Embedding Model with Model Name
embed-english-v3.0and connect it as the embedding model for Pinecone Retriever Tool. - Credential Required: Connect your Cohere credentials in Cohere Embedding Model.
Step 7: Configure Notifications and Outbound Actions
Set up all email and social outputs to deliver category-specific notifications.
- Connect Post to X Feed with Text set to
=Another happy customer said: " {{ $json.textPlain }}". - Credential Required: Connect your Twitter credentials in Post to X Feed.
- Connect SMTP credentials to all emailSend nodes (9 nodes including Send Inquiry Reply, Confirm Complaint Receipt, Alert Support Staff, Forward Billing Email, Notify Sales Crew, Notify Feedback Team, Acceptance to Candidate, Send Rejection Notice, and Notify HR Team).
- Validate dynamic recipient expressions such as
={{ $('IMAP Email Listener').item.json.from }}in Send Inquiry Reply and Acceptance to Candidate.
⚠️ Common Pitfall: Several fromEmail fields use {{ demo_from_email } (missing closing braces). Correct these to {{ demo_from_email }} before going live.
Step 8: Test and Activate Your Workflow
Run end-to-end tests for both the document ingestion path and email categorization flow before activating.
- Click Execute Workflow and trigger Manual Start Trigger to verify Download File Request → Extract PDF Text → Pinecone Upsert Store completes successfully.
- Send a test email to the inbox used by IMAP Email Listener and confirm it flows through Subject Classifier Script, Category Router, and the appropriate output branch.
- Check that Feedback Sentiment Check sends to Post to X Feed and Notify Feedback Team as expected.
- When satisfied, toggle the workflow to Active for production use.
Troubleshooting Tips
- IMAP and Gmail credentials can expire or need specific permissions. If things break, check your email provider’s “app passwords” or IMAP access settings first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Quick Answers
About 10–15 minutes if your credentials are ready.
No. You’ll mainly connect accounts and adjust a few prompts and routing rules.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in LLM API costs, which are usually just a few cents per batch of classifications depending on volume.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you probably should. You can change the categories in the Category Router (switch) and update the “LLM Category Guess” prompt so it matches your labels and handoff rules. Common customizations include splitting “sales” into demo vs. partner inquiries, adding a VIP sender list that always alerts Slack, and swapping the reply templates used by the Send Inquiry Reply and Confirm Complaint Receipt nodes.
Usually it’s expired credentials or a missing permission scope on the Gmail connection. Reconnect the Gmail account in n8n and confirm IMAP access is enabled if you’re using the IMAP listener instead of a native Gmail trigger. If it works for a bit and then fails, rate limits or security checks from your Google workspace can also be the culprit, especially on shared inboxes.
A typical setup can comfortably handle dozens to a few hundred emails per day, and if you self-host there’s no execution cap beyond your server capacity.
For this workflow, n8n has a few advantages: more complex logic with unlimited branching at no extra cost, a self-hosting option for unlimited executions, and native AI/sentiment-style steps that are easier to control once you start routing edge cases. It also makes it simpler to “try rules first, then call AI,” which keeps costs predictable. Zapier or Make can be totally fine for simple “label then notify” flows, but they get clunky when you add fallback logic, normalized categories, and multiple response paths. Talk to an automation expert if you’re not sure which fits.
Once this is running, your inbox stops being a guessing game. The workflow handles the repetitive sorting and nudging, so your team can focus on the conversations that actually matter.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.