AI-Powered Gmail Triage, Urgency Classification, and Slack Digests - n8n Workflow

Use this sophisticated n8n workflow to triage incoming Gmail messages using GPT-4o for classification and summarization, instantly notifying high-urgency tasks via Slack, and maintaining logs in Google Sheets. Explore advanced n8n templates for AI email management.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Busy Professionals/Executives: Individuals overwhelmed by high email volumes needing automatic prioritization.
Startup Founders: Users requiring immediate alerts for critical communications (e.g., investor or high-priority customer emails).
n8n Automation Developers: Those looking for complex, real-world examples demonstrating AI integration, conditional logic, and multi-app communication within a single n8n workflow.
Users of n8n templates: Anyone seeking a robust email management solution that integrates Google Sheets, Gmail, Slack, and OpenAI.

Overview

Information overload is a major challenge for modern teams. This powerful n8n workflow solves this by injecting artificial intelligence directly into the inbox triage process. Instead of manually reviewing every message, this n8n automation template leverages the OpenAI n8n node (GPT-4o mini) to classify the email's urgency (High, Medium, Low) and its intent (To Respond, FYI, Notification). High-priority items immediately trigger an alert in Slack. Lower-priority items are collected and sent as a structured daily digest, ensuring nothing important is missed while maintaining focus. The entire history is logged cleanly in Google Sheets for auditing and analysis, making this n8n workflow an indispensable tool for productivity.

How it Works

The n8n workflow is initiated by a scheduled n8n trigger that runs every four hours.


  1. Email Retrieval: The Gmail n8n node first retrieves all necessary Gmail labels, and then fetches all new messages received within the last four hours.

  2. AI Classification: Each email is passed to the OpenAI n8n node, utilizing gpt-4o-mini with a detailed system prompt. This prompt forces the AI to return a clean JSON object containing the email's summary, urgency, category, and intent. This structured output is key to the reliability of this n8n workflow.

  3. Data Processing: A Code n8n node (Calculate Intent) is used to parse the raw AI JSON response, handling potential formatting errors, and dynamically mapping the AI-determined 'intent' (e.g., 'To Respond') to the corresponding unique Gmail label ID (e.g., AI Agent/To Respond).

  4. Conditional Routing: An If n8n node checks if the classified urgency is 'High'.

High Urgency Path: If true, a direct alert is sent via the Slack n8n node, the appropriate label is applied in Gmail, and the data is logged to a permanent Google Sheet (Sheet1).
Medium/Low Urgency Path: If false, the label is applied, and the data is logged to a temporary Google Sheet (Sheet2), which is designated for digest compilation.

  1. Digest Generation: After processing the latest batch, the n8n workflow proceeds to the digest compilation section. It retrieves all items from the temporary sheet (Sheet2), filters them based on a recent timestamp to ensure only the latest batch is included, and then a Code n8n node structures the data into a clear 'Medium Urgency' and 'Low Urgency' list. The resulting digest is sent to Slack using the Slack n8n node, completing the automation cycle of this advanced n8n workflow.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import the n8n Workflow: Copy and paste the provided JSON into your n8n instance using the 'Import Workflow' function.

  2. Credential Setup: Ensure you have active credentials configured for the Gmail, OpenAI, Slack, and Google Sheets n8n node connectors. Link each relevant n8n node to its respective credential.

  3. Google Sheets Configuration: Create a new Google Sheet named 'N8N - Emails' (or similar). This spreadsheet requires two tabs: Sheet1 (for all emails) and Sheet2 (for digest processing). Both tabs must have the header columns: From | Summary | Intent | Category | TimeStamp | Urgency.

  4. Gmail Labels: Crucially, create the necessary labels in Gmail in the format expected by the Code node: AI Agent/To Respond, AI Agent/FYI, AI Agent/Notification, etc. The n8n node relies on these exact names to map the AI output.

  5. Slack Channel: Configure the Slack n8n node to target the specific channel ID where urgent notifications and digests should be posted.

  6. Activation: Once all credentials and external dependencies are set, activate the n8n workflow. The schedule n8n trigger will handle running the process automatically.

Node Details

Schedule Trigger1 (n8n trigger): The starting point for this n8n workflow. It is configured to run periodically, checking for new emails every 4 hours.
Get many messages (Gmail n8n node): Fetches email messages from Gmail that were received in the period since the last execution. Uses a time expression to look back 4 hours (4 60 60 1000).
Message a model1 (OpenAI n8n node): Sends the email subject and snippet to GPT-4o-mini. The key configuration is the system prompt demanding a raw JSON output for classification.
Calculate Intent (Code n8n node): A critical component of this n8n workflow. It robustly parses the AI's JSON output, handles parsing failures, and maps the AI's 'intent' value to the corresponding Gmail label ID required by subsequent Gmail n8n nodes.
If1 (If n8n node): Directs the flow based on the classification. It specifically checks if urgency equals 'High'.
Send a message2 (Slack n8n node): Used in the high-urgency path to send immediate, detailed alerts containing the summary, sender, and classification.
Add label to message3/2 (Gmail n8n node): Dynamically applies the appropriate AI Agent/Intent label ID back to the processed email in Gmail.
Append row in sheet1/2 (Google Sheets n8n node): Logs the classified email data. Sheet1 stores all data, while Sheet2 is used as a temporary holding area for emails slated for the periodic digest.
Daily Digest Preparation (Code n8n node): Structures the collected Medium and Low urgency items from the Google Sheet into a single, clean markdown string, ready for the final Slack n8n node.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

Building AI Security Engineer

Featured*