Skip to main content

Auto-label Gmail messages with custom categories using GPT-4o-mini

Workflow preview

Workflow preview
100%
Auto-label Gmail messages with custom categories using GPT-4o-mini preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Why settle for Gmail’s default tabs when AI can sort your inbox your way? Who is this for? Job seekers, freelancers, and students who receive job...

Best for

  • AI Summarization automation workflows
  • Multimodal AI automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.lmchatopenai, n8n-nodes-base.gmail, @n8n/n8n-nodes-langchain.textclassifier, n8n-nodes-base.cron

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Ashish Kumar Swain.

Original n8n.io source

1.1 Workflow description

Title
Auto-label Gmail messages with custom categories using GPT-4o-mini
Workflow name
Auto-label Gmail messages with custom categories using GPT-4o-mini

Why settle for Gmail’s default tabs when AI can sort your inbox your way?

Who is this for?

Job seekers, freelancers, and students who receive job-related emails and want them auto-sorted into labels

Use case

  • Problem: Job emails get buried.Manually reading, labeling, and tracking them in a sheet is error-prone and time-consuming.

  • Use Case: An n8n workflow that fetches new Gmail messages on a schedule, classifies them with OpenAI, adds customised Gmail labels defined by the user.

What this workflow does?

  1. Runs on a schedule (Cron) to fetch new Gmail messages.
  2. Uses OpenAI to classify each email into: Job Opportunity, Application Status, Enquiries, or Others (you can edit categories).
  3. Adds Gmail labels accordingly (auto-creates them if missing).

Prerequisites

  • n8n (Cloud or self-hosted).
  • Credentials set up in n8n:
    • Gmail OAuth
    • OpenAI (API key)

Setup

  • Import the JSON (below) into n8n.
  • Open Credentials for Gmail, OpenAI.
  • In the OpenAI node, pick your model (e.g., gpt-4o-mini or any GPT-4 class model).
  • In the Gmail Add Labels nodes, confirm/adjust label names:
    • Job Opportunity, Application Status, Enquiries, Others

How to customize it for your needs

  • Add a Follow-Up Date parser (e.g., “We’ll get back in 2 weeks”) → push to Calendar.

  • Extend categories (e.g., Interview Invite, Offer, Rejection, HR Enquiry).

  • Threaded Gmail Draft Reply for Enquiries using a template.

Troubleshooting

  • No items flowing? Check Gmail scope/label filters and Cron timing.

  • Labels not created? The Gmail node can create them; ensure the label names match exactly.

Why Use This Template?

Gmail can classify messages into Spam, Promotions, or Social, but have you ever wished you could sort emails your own way?

With this AI-powered workflow, you can create custom categories that fit your needs — like Job Opportunity, Application Status, or Enquiries — so you never lose track of what matters.

Need Assistance?

For setup guidance, customization, or business inquiries, Email: [email protected]

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 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 2 - Job Opportunity

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

Block 3 - Application Status

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

Block 4 - Others

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

Block 5 - Enquiries

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

Block 6 - Email Classifier

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

Block 7 - Daily Email Check

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

Block 8 - Fetch New Emails

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

3. Summary Table

Workflow Auto-label Gmail messages with custom categories using GPT-4o-mini
Complexity intermediate
Nodes 8
Categories AI Summarization, Multimodal AI
Author Ashish Kumar Swain
Published 16 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7477/7477.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 Auto-label Gmail messages with custom categories using GPT-4o-mini do?

Why settle for Gmail’s default tabs when AI can sort your inbox your way? Who is this for? Job seekers, freelancers, and students who receive job...

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