AI-Powered Gmail Smart Sorting with Custom Labels
detail.loadingPreview
This n8n workflow intelligently categorizes and labels your incoming Gmail emails using AI, based on custom categories you define in a Google Sheet. It automates the often tedious task of email organization, ensuring your inbox stays perfectly sorted without manual intervention.
About This Workflow
Revolutionize your inbox management with this powerful n8n workflow that brings AI-driven classification directly to your Gmail. By centralizing your email categories in a simple Google Sheet, you gain ultimate flexibility and control over your classification logic, all without writing a single line of code. The workflow is designed to periodically fetch emails, leverage an OpenRouter-powered AI model to intelligently categorize each message based on your predefined labels, and then automatically create new Gmail labels if they don't yet exist. Finally, it applies the correct, AI-determined label to the relevant email thread, ensuring a perpetually tidy, searchable, and efficiently organized inbox. Focus on what matters, and let AI handle the sorting.
Key Features
- AI-Powered Email Classification: Automatically categorizes emails using advanced language models.
- Customizable Categories: Define and manage your email classification labels easily within a Google Sheet.
- Dynamic Gmail Label Creation: Automatically creates new Gmail labels for categories identified by the AI if they don't already exist.
- Automated Label Application: Applies the appropriate, AI-determined label directly to your Gmail email threads.
- Flexible AI Integration: Connects with OpenRouter, allowing you to choose from a wide array of AI models, including free options.
How To Use
- Prepare your Google Sheet: Create a Google Sheet that will store your email categories. Each row should contain a category 'Name' (e.g., 'Support', 'Sales', 'Marketing'). Note the URL of this sheet.
- Configure the 'Config' Node: In the 'Config' node, update the
sheets_urlparameter with the exact URL of your Google Sheet. - Connect Google Sheets: Authenticate the 'Get Labels' node with your Google Sheets account, granting access to the sheet you configured.
- Connect AI (OpenRouter): In the 'OpenRouter Chat Model' node, click 'Add Credential' and enter your OpenRouter API Key. Select your preferred AI model (refer to the sticky notes for free/recommended options).
- Connect Gmail: Authenticate the 'Create Label if Doesn't exist', 'Get Existing Labels', and 'Gmail1' nodes with your Gmail account, ensuring permissions to read emails and manage labels.
- (Important) Add Email Source: Although not shown in this snippet, you will need to add a node (e.g., a Gmail 'Read Email' or 'New Email' trigger) before the 'Config' node to provide the email subject and text for AI classification.
- Activate Workflow: Once all connections and configurations are complete, activate the 'Schedule Trigger' to begin automated, AI-powered email sorting at your defined intervals.
Apps Used
Workflow JSON
{
"id": "34043423-c070-40cd-8763-cc41adaf72ae",
"name": "AI-Powered Gmail Smart Sorting with Custom Labels",
"nodes": 5,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 34043423-c070...
About the Author
Free n8n Workflows Official
System Admin
The official repository for verified enterprise-grade workflows.
Statistics
Related Workflows
Discover more workflows you might like
Universal CSV to JSON API Converter
Effortlessly transform CSV data into structured JSON with this versatile n8n workflow. Integrate it into any application as a custom API endpoint, supporting various input methods including file uploads and raw text.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.