Automatic Email Categorization and Labeling with Gmail and GPT-4o
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
Who is this for?
If your inbox is full of unread emails, this workflow is for you.
Instead of reading through them one by one, let AI do the sorting.
It reads your emails and flags only what needs action.
What does it solve?
This workflow reads your unread Gmail emails and uses AI to decide what’s important — and what’s not. It labels emails that need your attention, identifies receipts, and trashes everything else. No more manual reading. Just an inbox that uses AI to take care of itself.
How it works
Every hour, the workflow runs automatically. It searches for unread emails in your Gmail inbox. For each email: It extracts the content and sends it to OpenAI. The AI returns one of four labels: Action, Receipt, Informational or Spam. Based on the label: Emails are marked with the appropriate label. Or moved to trash it is spam. It marks the email as read once processed.
How to set up?
Connect these services in your n8n credentials:
Gmail (OAuth2)
OpenAI (API key)
Create the Gmail labels:
In your Gmail account, create these labels exactly as written:
Action, Receipt, and Informational
The workflow will apply these labels based on AI classification.
How to customize this workflow to your needs
Change the AI prompt to detect more types of emails like Meeting or Newsletter. Add more branches to the Switch node to apply custom logic. Change the schedule to fit your workflow. By default, it runs every hour, but you can update this in the Schedule Trigger node.
Related Templates
Instagram Full Profile Scraper with Apify and Google Sheets
📸 Instagram Full Profile Scraper with Apify and Google Sheets This n8n workflow automates the process of scraping ful...
Generate Product Ad Copy & CTAs with GPT-4 for Slack and Airtable
⚡ AI Copywriter Pro: Instant Ad Copy & CTA Generator Transform product details into compelling marketing copy in second...
Technology News Workflow Explanation with Key Services
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. Auto-Publish Techn...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments