Automatically Label Gmail Emails with GPT-5 Classification
Last edited 58 days ago
How it works
This workflow automatically monitors your Gmail inbox and uses OpenAI's GPT model to intelligently classify incoming emails into four key categories:
- High Priority - Urgent emails requiring immediate attention from executives, clients, or stakeholders
- Promotion - Marketing emails, sales offers, product launches, and event invitations
- Finance/Billing - Invoices, receipts, payment notifications, and financial records
- Customer Support - Help requests, troubleshooting queries, and service-related issues
Once classified, emails are automatically labeled in Gmail using the appropriate tags, making it easy to filter, search, and prioritize your communications.
How to set up
Requirements
- Gmail account with OAuth2 access enabled
- OpenAI API key with GPT model access
- Custom Gmail labels created for each category
Step-by-step setup
- Create Gmail Labels
- In Gmail, create these labels: "High Priority", "Promotion", "Finance/Billing", "Customer Support"
- Note the label IDs (you'll need to replace the hardcoded ones in the workflow)
- Configure Credentials
- Add your Gmail OAuth2 credentials in n8n
- Add your OpenAI API credentials
- Update Label IDs
- Replace the hardcoded label IDs in each Gmail node with your actual label IDs
- You can find label IDs by testing the Gmail node or using Gmail API
- Adjust Classification Rules
- Review the Text Classifier categories and modify descriptions to match your specific needs
- Add or remove categories as required
- Set Polling Frequency
- The workflow is set to check every minute - adjust based on your email volume
You may also like
New to n8n?
Need help building new n8n workflows? Process automation for you or your company will save you time and money, and it's completely free!





