Smart Gmail Labeling Automation with Text Classifier and GPT-5

Go to Workflow
15 views
Built by Billy Christi Billy Christi
Created on June 06, 2026

Description

What this workflow does

This workflow automatically organizes your Gmail inbox by fetching recent emails, analyzing their content with AI, and applying the appropriate Gmail labels based on the results.

Step by step:
Schedule Trigger runs the workflow automatically at your chosen interval
Gmail Fetch retrieves the latest emails from your inbox
Loop Over Items processes each email individually
AI Text Classifier analyzes email subject and body content to determine the right category
Add Labels applies the matching Gmail label according to the AI classification
Loop Back continues until all emails are processed and organized

How to set up

Connect your Gmail account to the Gmail nodes for fetching emails and adding labels
Add your OpenAI API key to the OpenAI Chat Model node for AI-powered classification
Configure the schedule trigger to run at your preferred interval (default: every 5 minutes)
Customize email categories in the Label Classifier node based on your organizational needs
Set up Gmail labels that match your classification categories in your Gmail account
Adjust the time range for fetching emails (default: last 5 minutes) and email limit (default: 10)
Test the workflow with a few sample emails to ensure proper classification and labeling
Monitor the workflow execution to verify emails are being processed and labeled correctly

How to customize this workflow to your needs

Adjust classification categories**: modify the Label Classifier node to include categories like "Work", "Bills", "Social", "Newsletters", or any custom categories you need
Change time intervals**: customize the schedule trigger to run hourly, daily, or at specific times based on your email volume
Add more label actions**: create additional Gmail label nodes for more granular categorization (urgent, follow-up, archive, etc.)

Need help customizing?

Contact me for consulting and support:
📧 [email protected]

Nodes Used (3)

Gmail
n8n-nodes-base.gmail
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Text Classifier
@n8n/n8n-nodes-langchain.textClassifier