Skip to product information
N8N Template - Intelligent Gmail Labeling with GPT-5 Email Classifier

What This Workflow Does

This automation keeps your Gmail inbox organized by:

  • Fetching recent emails at set intervals

  • Analyzing the subject and body text with GPT-5 for classification

  • Automatically applying the correct Gmail labels based on the AI results

 

 

 Step-by-Step Process

  1. Schedule Trigger – Starts the workflow automatically at the interval you define.

  2. Gmail Fetch – Collects the most recent emails from your inbox.

  3. Loop Over Items – Processes each message individually.

  4. AI Text Classifier – Uses GPT-5 to determine the appropriate category.

  5. Add Labels – Applies the Gmail label that matches the classification result.

  6. Loop Back – Repeats the process until all emails are categorized.

 

 

 

⚙️ Setup Instructions

 

 

  • Connect Gmail → Authorize Gmail credentials for fetching and labeling emails.

  • Connect OpenAI → Insert your OpenAI API key in the Chat Model node.

  • Schedule Trigger → Choose how often the workflow should run (default: every 5 minutes).

  • Categories → Edit the Label Classifier to match your own categories.

  • Gmail Labels → Create or adjust Gmail labels to align with your classification setup.

  • Fetch Settings → Define the time window (default: last 5 minutes) and email limit (default: 10).

  • Testing → Run a trial with a few emails to confirm correct categorization.

  • Monitoring → Check execution logs to ensure labeling is applied properly.

 

Customization Options

  • Refine categories – Add or modify labels such as Work, Finance, Social, Newsletters, Urgent.

  • Change intervals – Adjust the schedule to run hourly, daily, or at custom times.

  • Expand labeling – Add more Gmail label nodes for specific needs like Follow-Up, Archive, or Clients.

 

 

How to Import and Use Your n8n Template

Import in n8n

Open n8n → go to WorkflowsImport from File → select the JSON file you received.

Connect Credentials

Open nodes marked with a warning, add your API keys (Shopify, Gmail, etc.), then Save and Execute.


 

You may also like