Skip to main content

Automatically classify and label Gmail emails with Google Gemini AI

Workflow preview

Workflow preview
100%
Automatically classify and label Gmail emails with Google Gemini AI preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Description Quickly organize your inbox with AI! This simple workflow automatically classifies incoming emails into different categories — like High Priority, Work Related, or Promotions — and appl...

Best for

  • Personal Productivity automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.gmailtrigger, @n8n/n8n-nodes-langchain.lmchatgooglegemini, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatgroq, n8n-nodes-base.gmail, @n8n/n8n-nodes-langchain.textclassifier, n8n-nodes-base.stickynote

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Automatically classify and label Gmail emails with Google Gemini AI
Workflow name
Automatically classify and label Gmail emails with Google Gemini AI

Description

Quickly organize your inbox with AI! This simple workflow automatically classifies incoming emails into different categories — like High Priority, Work Related, or Promotions — and applies Gmail labels accordingly. Setup takes less than 2 minutes, and it runs 24/7, helping you stay focused on what matters most without manual sorting.

Tools/Services Needed

  • Gmail: To trigger the workflow and label emails.
  • Google Gemini (or any LLM Model): To intelligently classify email content.

How It Works

  1. Gmail Trigger: Detects every new incoming email.

  2. Text Classifier Node: Classifies the email content into predefined categories.

  3. Google Gemini Chat Model: Provides the AI-powered understanding behind the classification.

  4. Conditional Labeling:

  • If the email is High Priority, label it accordingly.
  • If it’s Work Related (e.g., internal emails), apply the work label.
  • If it’s a Promotion, sort it into the promotions label.
  1. Gmail Labeling: Automatically adds the correct label to the email.

Setup Instructions

  • Connect your Gmail account to n8n.
  • Connect your Google Gemini (or other LLM) credentials.
  • Customize the categories and labels if needed.
  • Activate the workflow — and that's it!

Notes

  • You can easily add more categories (like "Finance," "Newsletters," etc.) by adjusting the classification prompt.
  • Works best with a clean and minimal set of categories to avoid overlap.
  • Can be adapted to work with any other large language model (OpenAI, Claude, etc.) if preferred.

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 - Gmail Trigger

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

Block 2 - Google Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 3 - AI Agent

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

Block 4 - Groq Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGroq - lmChatGroq
Config choices
Version 1

Block 5 - Gmail3

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 6 - Classification Agent

Type / Role
@n8n/n8n-nodes-langchain.textClassifier - textClassifier
Config choices
Version 1

Block 7 - Sticky Note

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

Block 8 - Sticky Note1

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

Block 9 - Sticky Note2

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

Block 10 - Sticky Note3

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

Block 11 - Add Label Promotion

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 12 - Add Label (KS Work Related)

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 13 - Add Label (High Priority)

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 14 - Sticky Note4

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

Block 15 - Sticky Note5

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

3. Summary Table

Workflow Automatically classify and label Gmail emails with Google Gemini AI
Complexity advanced
Nodes 15
Categories Personal Productivity, AI Summarization
Author Jakkrapat Ampring
Published 28 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3772/3772.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 Automatically classify and label Gmail emails with Google Gemini AI do?

Description Quickly organize your inbox with AI! This simple workflow automatically classifies incoming emails into different categories — like High Priority, Work Related, or Promotions — and appl...

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 Personal Productivity, AI Summarization use case.