We use cookies to understand how you use our site and improve your experience. Privacy Policy

Back to Blog
Automation Workflows

Gmail Labels to Slack Alerts with n8n

n8n
n8n Resources Team
June 4, 2026

Ready to automate?

Browse 5,000+ copy-paste n8n workflow templates.

The Problem With Email-Based Team Communication

Important emails disappear. A client escalation lands in Gmail, sits labeled but unread, and by the time someone catches it two hours later the moment to respond quickly is gone. CC chains and forwarding rules help at small scale, but they break down fast — wrong person gets it, nobody owns it, or the original context gets buried in a reply thread.

The root issue is that Gmail and Slack don't talk to each other. Email is where information arrives; Slack is where decisions happen. Without an integration layer, you are manually bridging the two — and that manual step is exactly where things slip.

n8n solves this with a three-node workflow that watches a Gmail label, applies a keyword filter, and posts a formatted Slack alert to the right channel. The workflow runs continuously, requires no code, and can be extended in minutes to handle daily digests or route messages directly to individuals.

What You Will Build

The core workflow handles one clear job: when an email lands in a specific Gmail label, check it for priority keywords, and if it matches, send a structured Slack notification with sender, subject, preview text, and a direct link to the thread.

Two extensions build on that foundation:

  • Daily digest: Replace the real-time trigger with a scheduler that batches unread label emails into a single morning summary message.
  • Direct DM routing: Route messages from specific sender domains to the right Slack user's DMs instead of a shared channel.

Prerequisites

Before building, confirm you have:

  • An n8n instance (cloud or self-hosted — both work identically for this workflow)
  • A Google OAuth credential in n8n with Gmail read access
  • A Slack OAuth credential with the chat:write and users:read.email scopes
  • At least one Gmail label configured, such as "Client-Urgent" or "Needs-Review"

Example n8n Workflow

Step 1: Gmail Trigger Node

Start the workflow with a Gmail Trigger node. Set the event type to Message Received and select the label you want to monitor. Configure the polling interval to one minute — this gives near-real-time detection while staying well within Gmail API rate limits.

The Gmail Trigger outputs a full email object on each execution: sender name and address, subject line, body text (plain and HTML), label list, and thread ID. All of these fields are available to downstream nodes via n8n's expression editor.

Step 2: IF Node — Keyword Filter

Connect an IF node directly to the Gmail Trigger. This is the routing gate that separates priority emails from everything else.

In the condition field, write a regex expression against the subject: {{ $json.subject.match(/(urgent|deadline|invoice|action required|needs attention)/i) !== null }}. Emails where the subject matches route to the true branch; all others route to the false branch. You can extend the regex with body text patterns if subject-only filtering is too narrow for your use case.

The false branch can end with a No Operation node, or connect to a second Gmail node that removes the watched label and applies an "Acknowledged" label, so processed emails don't re-trigger on the next poll.

Step 3: Slack Node — Formatted Alert

On the true branch, add a Slack node set to the Send Message operation. Point it at your target channel — #client-comms, #ops-alerts, or whatever makes sense for your team.

Use Slack's Block Kit format for the message body. A practical layout for email alerts:

  • First block: bold subject line as the headline
  • Second block: sender name and email address on one line
  • Third block: the first 250 characters of the email body as a preview
  • Action block: a "View in Gmail" button linking to https://mail.google.com/mail/u/0/#inbox/{{ $json.threadId }}

This gives the Slack reader enough context to decide whether to open Gmail. Most responses can happen directly in the Slack thread reply without switching apps.

Variation: Daily Digest Mode

If real-time alerts generate too much noise, swap the Gmail Trigger for a Schedule Trigger node. Set it to run at 8:00 AM in your team's timezone.

Connect the Schedule Trigger to a Gmail node in Get All Messages mode. Set the search query to label:Needs-Review with an additional date filter for the last 24 hours: after:{{ new Date(Date.now() - 86400000).toISOString().split('T')[0] }}.

The Gmail node returns an array of matching messages. Pass them through a Code node to build a formatted summary string — one line per email with subject and sender. Wrap the output in a single Slack message that opens with a count: "You have 4 emails awaiting review this morning." One message, full context, no channel noise during the day.

Variation: Direct DM by Sender Domain

Some emails need to reach a specific person, not a shared channel. After the main IF node, add a second IF node that checks whether $json.from contains a VIP domain — for example, @bigclient.com.

On the match branch, add a Slack node in Find User by Email mode. It uses the sender's email address to look up the corresponding Slack user (this requires the users:read.email scope on your credential). The returned user ID feeds into a second Slack node configured for direct message delivery.

This pattern removes the manual step of forwarding urgent client emails to account managers. It also keeps DMs cleaner than channel posts because each person only gets the messages relevant to their accounts.

Handling Common Edge Cases

Duplicate alerts: Gmail's label system can assign the same label multiple times, or a label-matching filter can fire on a message that was already processed. Add a Deduplication node after the Gmail Trigger and use threadId as the unique key to block repeated alerts from the same thread.

Polling lag: The one-minute polling interval introduces up to 60 seconds of delay. For workflows where sub-minute delivery matters — on-call alerts, payment failures — replace the Gmail Trigger with a Webhook Trigger node connected to Gmail Push Notifications via Google Cloud Pub/Sub. Setup takes about 15 additional minutes but delivers near-instant execution.

OAuth token expiry: Google OAuth credentials in long-running n8n instances can expire if not refreshed. Configure n8n's built-in Error Workflow feature to send a Slack message to an admin channel whenever the Gmail Trigger throws an authentication error. This prevents silent failures where the workflow stops working without anyone noticing.

What This Workflow Solves

The Gmail-to-Slack bridge is one of the highest-leverage integrations a team can build. It removes the manual overhead of monitoring email, gives Slack the context it was missing, and keeps the right people informed without expanding CC lists or creating additional inboxes.

Once the core workflow runs reliably, extending it is straightforward. Append an Airtable node to the Slack branch to log every routed email to a tracker. Connect a Notion node to automatically create an action item from flagged messages. Add a second Slack node on the false branch to forward low-priority emails to a weekly digest channel instead of discarding them.

For ready-to-use templates that connect Gmail and Slack, see the n8n Gmail integration page and the n8n Slack integration page. If you are building a broader email routing or notification strategy, the email automation use case page covers additional patterns organized by business function.

Browse the full library of n8n workflow templates at n8nresources.dev/templates, or subscribe to receive new templates each week.

Enjoyed this article?

Share it with others who might find it useful