Skip to main content

Route Gmail emails to Slack by intent using OpenAI and log to Sheets

Workflow preview

Workflow preview
100%
Route Gmail emails to Slack by intent using OpenAI and log to Sheets preview
Open on n8n.io

1. Workflow Overview

If your team shares an inbox and someone has to manually read every email to decide where it goes, this workflow takes that off your plate. Emails come in, AI reads them, and the right Slack channe...

Best for

  • Ticket Management automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.gmailtrigger, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.code, n8n-nodes-base.switch, n8n-nodes-base.slack, n8n-nodes-base.googlesheets

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Anwar Bouilouta.

Original n8n.io source

1.1 Workflow description

Title
Route Gmail emails to Slack by intent using OpenAI and log to Sheets
Workflow name
Route Gmail emails to Slack by intent using OpenAI and log to Sheets

If your team shares an inbox and someone has to manually read every email to decide where it goes, this workflow takes that off your plate. Emails come in, AI reads them, and the right Slack channel gets notified with a summary and priority level.

Who is this for

Teams that receive a mix of sales inquiries, support requests, and billing questions through a shared inbox. Instead of someone triaging emails by hand every morning, the AI handles it in real time.

How it works

The workflow polls Gmail for new emails every minute. Each email gets sent to OpenAI (gpt-4o-mini by default) with a prompt that classifies it into one of four categories: sales, support, billing, or spam.

The AI also writes a short summary and assigns a priority level (low, medium, or high). A Switch node then routes the message to the correct Slack channel. Spam gets quietly dropped so your team never sees it.

Every email that comes through gets logged to a Google Sheet with its timestamp, sender, subject, category, priority, and AI summary. So you always have a record of what came in and how it was handled.

How to set it up

  1. Connect your Gmail, OpenAI, Slack, and Google Sheets credentials in n8n
  2. Create a Google Sheet with these columns: Timestamp, From, Subject, Category, Priority, Summary
  3. Open the "Configure Settings" node and fill in your Slack channel IDs for sales, support, and billing, plus your Google Sheet ID
  4. Activate the workflow and send yourself a test email

Requirements

  • Gmail account with OAuth connected in n8n
  • OpenAI API key (gpt-4o-mini costs roughly $0.15 per 1M input tokens, so classification is very cheap)
  • Slack workspace with OAuth connected in n8n
  • Google Sheets for logging

Customizing the workflow

Want more categories? Edit the system prompt in the "Classify Email Intent" node to add new categories (e.g. "partnerships", "recruitment"), then add matching outputs to the Switch node and wire them to new Slack channels.

You can also change the polling interval on the Gmail trigger if every minute is too frequent. And if you want more accurate classification, swap gpt-4o-mini for gpt-4o in the OpenAI node, though it'll cost a bit more per email.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Watch for New Emails

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 8 - Configure Settings

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - Classify Email Intent

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 10 - Parse AI Response

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Route by Category

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 12 - Send to Sales Channel

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 13 - Send to Support Channel

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 14 - Send to Billing Channel

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 15 - Log to Google Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

3. Summary Table

Workflow Route Gmail emails to Slack by intent using OpenAI and log to Sheets
Complexity advanced
Nodes 15
Categories Ticket Management, AI Summarization
Author Anwar Bouilouta
Published 19 Mar 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14178/14178.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Route Gmail emails to Slack by intent using OpenAI and log to Sheets do?

If your team shares an inbox and someone has to manually read every email to decide where it goes, this workflow takes that off your plate. Emails come in, AI reads them, and the right Slack channe...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Ticket Management, AI Summarization use case.