🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Gmail + Slack: urgent emails flagged, labels stay tidy

Lisa Granqvist Partner Workflow Automation Expert

Your inbox is probably “organized” right up until the day it isn’t. One urgent customer thread hides behind newsletters, random CCs, and meeting logistics, and suddenly you’re reacting instead of working.

This Gmail Slack automation hits support leads first, honestly, but ops managers and agency owners feel it too. The outcome is simple: urgent emails get flagged and pushed to Slack, while everything else gets labeled automatically so you can stop babysitting Gmail.

Below you’ll see exactly what this workflow does, what you need to connect, and how the pieces fit together before you decide to implement it.

How This Automation Works

Here’s the complete workflow you’ll be setting up:

n8n Workflow Template: Gmail + Slack: urgent emails flagged, labels stay tidy

Why This Matters: Inbox triage steals your best hours

Most inbox stress isn’t caused by “too much email.” It’s the constant sorting. You scan subject lines, open messages “just in case,” decide what to do, then forget where you put it. And when something truly urgent shows up, it looks exactly like the five things you already postponed. That mental load is sneaky. It eats the first hour of your day, breaks your focus, and makes you slower at the work you’re actually paid to do.

It adds up fast. Here’s where it breaks down in real teams.

  • Urgent requests get buried because “unread” is not a priority system.
  • Manual labeling is inconsistent, so the same type of email ends up scattered across your inbox.
  • You spend about 1–2 hours a day re-reading emails just to remember what matters.
  • Nothing gets logged, which means you can’t review patterns, volume, or recurring senders when problems keep repeating.

What You’ll Build: AI email labeling with urgent Slack alerts

This workflow watches your Gmail inbox every couple minutes for unread messages. When a new email lands, it cleans up the messy HTML (so the content is readable), then sends the important parts to an AI agent for classification and entity extraction. The AI returns a structured result that is parsed into clean JSON, validated, and checked for quality before anything touches your inbox. Once the category is confirmed, n8n routes the message through a nine-way sorter (Inquiry, Support, Newsletter, Marketing, Personal, Urgent, Spam, Invoice, Meeting) and applies the right Gmail label automatically. Finally, every email gets recorded to Google Sheets for tracking, and truly urgent messages trigger a Slack alert so you see them immediately.

The workflow starts with a Gmail trigger, then runs AI classification with a structured parser to keep outputs predictable. After that, routing applies the correct label, logging happens in Google Sheets, and high-priority items get pushed into Slack so you can react fast without living in Gmail.

What You’re Building

Expected Results

Say your team gets about 40 emails a day in a shared inbox. Manually sorting and labeling even 1 minute per email is roughly 40 minutes, and urgent ones still slip through when you’re heads-down. With this workflow, the “work” is basically zero: Gmail gets checked every 2 minutes, labeling happens automatically, and urgent items post to Slack as they arrive. You’ll still read and respond, but you stop spending about an hour just organizing.

Before You Start

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Gmail to monitor unread emails and apply labels.
  • Slack to receive urgent email alerts.
  • OpenAI API key (get it from the OpenAI dashboard) or another LLM provider supported in your setup.

Skill level: Intermediate. You’ll connect accounts, paste an API key, and adjust categories without writing much code.

Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).

Step by Step

A new unread email arrives. The Gmail trigger polls your inbox every 2 minutes and pulls in the subject, sender, and message content for anything unread.

The email gets cleaned up. A sanitizing step strips noisy HTML so signatures, tracking junk, and weird formatting don’t confuse the classifier.

AI categorizes the message. The AI agent (using an OpenAI chat model in this template) classifies the email and extracts entities, then a structured output parser converts that result into predictable JSON that can be validated.

Labels, logs, and alerts happen automatically. n8n routes the email to the correct category, applies the Gmail label, records the event in Google Sheets, and sends a Slack alert if the message is flagged as high priority.

You can easily modify the nine categories to match your business (or route to a different Slack channel) based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Gmail Trigger

Start by setting up the workflow trigger that polls unread Gmail messages on a schedule.

  1. Add and open Gmail Poll Trigger.
  2. Set Filters → Read Status to unread.
  3. Set Poll Times to everyMinute.
  4. Credential Required: Connect your Gmail credentials (Google OAuth) to Gmail Poll Trigger.

Step 2: Connect Google Sheets

Configure the two Sheets nodes to log classified emails and classification errors.

  1. Open Record All Emails and select the target spreadsheet in Document, then set Sheet Name to Sheet1.
  2. Verify the column mappings include values like {{ $json.subject }}, {{ $json.category }}, and {{ $json.actionItemsJson }}.
  3. Credential Required: Connect your googleSheetsOAuth2Api credentials to Record All Emails.
  4. Open Record Classification Errors and set Sheet Name to Error Log.
  5. Credential Required: Connect your googleSheetsOAuth2Api credentials to Record Classification Errors.

Step 3: Set Up AI Classification and Parsing

Configure the AI agent, language model, and structured parser that classify and extract entities from emails.

  1. Open Categorize and Pull Entities and set Text to Sender: {{ $json.senderName }} ({{ $json.senderEmail }})\nSubject: {{ $json.subject }}\nBody: {{ $json.bodyText }}.
  2. In OpenAI Conversation Model, set Model to gpt-4.1-mini, Max Tokens to 1500, and Temperature to 0.2.
  3. Open Structured Result Parser and confirm the JSON Schema Example matches your desired fields (category, priority, sentiment, entities, actionItems, summary).
  4. Credential Required: Connect your OpenAI credentials to OpenAI Conversation Model.
  5. Note: Structured Result Parser is an AI tool sub-node; credentials should be added to OpenAI Conversation Model, not the parser.

Step 4: Configure Processing and Validation Logic

Clean the email payload, validate AI results, and route valid classifications.

  1. Open Sanitize Email Payload and keep the JavaScript logic that extracts messageId, senderEmail, subject, and a bodyText limited to 3000 characters.
  2. Open Validate AI Output and keep Mode as runOnceForEachItem to enforce valid categories, priorities, and sentiments.
  3. Open Verify Classification Result and ensure the condition checks {{ $json.classificationValid }} is true.
  4. Open Route by Email Category and confirm the rules compare {{ $json.category }} to values like Inquiry, Support Request, and Urgent.

Validate AI Output outputs to both Verify Classification Result and Flag High Priority in parallel.

⚠️ Common Pitfall: If categories from the AI don't match the switch rules (e.g., "Support Request"), Route by Email Category will fall back to the default output. Keep the AI category list aligned with the switch rules.

Step 5: Configure Output and Notification Actions

Apply Gmail labels, record results, and send urgent alerts to Slack.

  1. For each Gmail label node (Apply Label: Inquiry, Apply Label: Support, Apply Label: Newsletter, Apply Label: Marketing, Apply Label: Personal, Apply Label: Urgent, Apply Label: Spam, Apply Label: Invoice, Apply Label: Meeting), set Operation to addLabels and Message ID to {{ $('Sanitize Email Payload').first().json.messageId }}.
  2. Credential Required: Connect your Gmail credentials (Google OAuth) to all Gmail label nodes.
  3. Open Flag High Priority and ensure conditions include {{ $json.priority }} = High, {{ $json.category }} = Urgent, or {{ $json.sentiment }} = Urgent.
  4. Open Send Urgent Slack Alert and keep Text as the multi-line template starting with 🚨 *URGENT EMAIL ALERT*.
  5. Credential Required: Connect your Slack credentials to Send Urgent Slack Alert and select the target Channel.

Each label node routes into Record All Emails, ensuring all classified emails are logged after labeling.

Step 6: Add Error Handling

Invalid AI outputs are captured and recorded for review.

  1. In Verify Classification Result, ensure the false output is connected to Record Classification Errors.
  2. Confirm Record Classification Errors maps fields like {{ $json.classificationError }} and {{ $json.bodyText.substring(0, 500) }} for quick troubleshooting.
⚠️ Common Pitfall: If the Google Sheet for errors lacks the expected columns (e.g., “Error Message”), the append will fail. Match column headers exactly to the mapping in Record Classification Errors.

Step 7: Test and Activate Your Workflow

Run a controlled test to verify labeling, logging, and alerts before turning it on.

  1. Manually execute Gmail Poll Trigger with a sample unread email in your inbox.
  2. Check that labels are applied in Gmail and that a new row appears in Record All Emails.
  3. If you send a high-priority email, confirm Send Urgent Slack Alert posts the formatted message.
  4. For invalid or malformed AI results, verify that Record Classification Errors logs the issue.
  5. Once validated, toggle the workflow to Active for continuous automation.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Troubleshooting Tips

  • Gmail credentials can expire or need specific permissions. If things break, check your n8n Gmail credential connection test and Google account security 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

What’s the setup time for this Gmail Slack automation?

About 30 minutes if your accounts and API key are ready.

Is coding required for this Gmail Slack automation?

No. You’ll mostly connect credentials and tweak categories, with optional small edits to prompts and validation.

Is n8n free to use for this Gmail Slack automation workflow?

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 OpenAI API costs, which are usually a few cents per day for normal inbox volume.

Where can I host n8n to run this automation?

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.

Can I modify this Gmail Slack automation workflow for different use cases?

Yes, and you probably should. You can change the nine-way “Route by Email Category” switch to add or remove categories, then duplicate or delete the matching “Apply Label” Gmail nodes. Common tweaks include adding a “Refund” category, routing “Invoices” to accounting, and sending “Support” to a dedicated Slack channel while leaving newsletters silent.

Why is my Gmail connection failing in this workflow?

Usually it’s expired OAuth access or the wrong Gmail permissions. Reconnect your Gmail credential inside n8n, then confirm the trigger can read unread messages and the labeling nodes can modify labels. If it works for a while and then fails, check Google account security prompts and token revocations. Also watch for inbox rules moving messages out of “unread” before the poll runs.

What volume can this Gmail Slack automation workflow process?

A few hundred emails per day is realistic for most setups.

Is this Gmail Slack automation better than using Zapier or Make?

It depends on how strict you want the classification to be. This workflow uses AI with structured parsing, validation, and a multi-branch router, which n8n handles cleanly without turning into a maze of paid steps. You also get self-hosting as an option, which matters once you’re processing lots of emails. Zapier and Make can work, but complex branching plus AI steps tends to get expensive and harder to debug. If you want help choosing, Talk to an automation expert.

Once this is running, your inbox stops being a to-do list you have to rebuild every morning. Urgent emails surface in Slack, everything else gets labeled, and you stay in control without hovering over Gmail.

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.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal