Smart email manager with Gmail, GPT-4 classification & auto-responses
AI Email Assistant - Smart Email Processing & Response π€
A sophisticated n8n workflow that transforms your email management with AI-powered classification, automatic responses, and intelligent organization.
π― What This Workflow Does
This advanced AI email assistant automatically:
- Analyzes incoming emails using intelligent classification
- Categorizes messages by priority, urgency, and type
- Generates context-aware draft responses in your voice
- Organizes emails with smart labeling and filing
- Alerts you to urgent messages instantly
- Manages attachments with cloud storage integration
Perfect for busy professionals, customer service teams, and anyone drowning in email!
β¨ Key Features
π§ Intelligent Email Analysis
- Context-Aware Processing: Understands email threads and conversation history
- Smart Classification: Automatically categorizes by priority, urgency, and required actions
- Multi-Criteria Assessment: Evaluates response needs, follow-up requirements, team involvement
- Dynamic Label Management: Syncs with your Gmail labels for consistent organization
π AI-Powered Response Generation
- Professional Draft Creation: Generates contextually appropriate responses
- Tone Matching: Mirrors the formality and style of incoming emails
- Multiple Response Options: Provides alternatives for complex inquiries
- Customizable Voice: Adapts to your business communication style
π Smart Notification System
- Urgent Email Alerts: Instant notifications for high-priority messages
- Telegram/Slack Integration: Get alerts where you work
- Smart Filtering: Only notifies when truly urgent
- Quick Action Links: Direct links to Gmail for immediate response
π Advanced Attachment Management
- Automatic Cloud Upload: Saves attachments to Google Drive
- Smart File Naming: Organized by date, sender, and content
- Duplicate Detection: Prevents redundant uploads
- File Type Filtering: Optional filtering for security
π·οΈ Intelligent Organization
- Auto-Labeling: Applies relevant Gmail labels automatically
- Progress Tracking: Marks emails as "processed" or "digested"
- Priority Indicators: Visual priority levels in your inbox
- Category-Based Sorting: Groups similar emails together
π οΈ Setup Instructions
Prerequisites
- n8n instance (cloud or self-hosted)
- Gmail account with API access
- OpenAI API key (or compatible AI service)
- Google Drive account (for attachments)
- Telegram bot (optional, for alerts)
Step 1: Import the Workflow
- Download
AI_Email_Assistant_Community_Template.json - In n8n, navigate to Templates β Import from File
- Select the downloaded JSON file
- The workflow will import as inactive
Step 2: Configure Credentials
Gmail Setup:
- Create Gmail OAuth2 credentials in n8n
- Configure the following nodes:
Email_TriggerGet Conversation ThreadGet Latest Message ContentCreate Draft ResponseAssign Classification LabelMark as ProcessedGet All Gmail Labels
- Test connections to ensure proper authentication
AI Model Setup:
- Configure the
AI Language Modelnode - Options include:
- OpenAI (GPT-4, GPT-3.5-turbo)
- Anthropic Claude (recommended)
- Local LLMs via Ollama
- Add your API credentials
- Test the connection
Google Drive Setup (Optional):
- Create Google Drive OAuth2 credentials
- Configure nodes:
Upload to Google DriveCheck Existing Attachments
- Replace
YOUR_GOOGLE_DRIVE_FOLDER_IDwith your folder ID - Create a dedicated folder for email attachments
Telegram Alerts (Optional):
- Create a Telegram bot via @BotFather
- Get your chat ID
- Configure the
Send Urgent Alertnode - Replace
YOUR_TELEGRAM_CHAT_IDwith your actual chat ID
Step 3: Customize AI Instructions
Email Classification (AI Email Classifier node):
- Review the classification criteria in the system message
- Adjust urgency keywords for your business
- Modify priority levels based on your needs
- Customize category definitions
Response Generation (AI Response Generator node):
- Update the response guidelines
- Replace
[YOUR NAME]with your actual name - Adjust tone and style preferences
- Add company-specific response templates
Step 4: Configure Gmail Labels
Create Custom Labels in Gmail:
- High Priority
- Medium Priority
- Low Priority
- Needs Response
- Urgent
- Follow Up Required
- Processed (or use existing labels)
Update Label IDs:
- Run the workflow once to get label IDs
- Replace
YOUR_PROCESSED_LABEL_IDin the "Mark as Processed" node - Update any hardcoded label references
Step 5: Test and Deploy
Testing Process:
- Send yourself a test email
- Monitor the workflow execution
- Verify classification accuracy
- Check draft response quality
- Confirm labeling works correctly
- Test urgent alert functionality
Fine-Tuning:
- Adjust AI prompts based on test results
- Refine classification criteria
- Update response templates
- Modify notification preferences
Go Live:
- Activate the workflow
- Monitor initial performance
- Adjust settings as needed
π Email Classification System
Priority Levels
- High: Urgent matters requiring immediate attention
- Medium: Important but not time-critical
- Low: Routine or informational messages
Classification Categories
- toReply: Direct questions or requests requiring response
- urgent: Immediate business impact or crisis situations
- dateRelated: Time-sensitive events or deadlines
- attachmentsToUpload: Financial docs or important files
- requiresFollowUp: Multi-step processes or ongoing projects
- forwardToTeam: Cross-departmental or collaborative items
Response Generation Guidelines
- Professional Tone: Business casual, warm but professional
- Context Awareness: Considers email thread history
- Structured Responses: Clear paragraphs with actionable next steps
- Placeholder System: Uses
[PLACEHOLDER]for missing information - Alternative Options: Provides multiple response choices for complex inquiries
π§ Advanced Customization
File Type Filtering
// In Get Specific File Types node, modify:
if (mimeType === 'application/pdf' ||
mimeType === 'text/xml' ||
mimeType === 'image/jpeg') {
// Process file
}
Custom Urgency Keywords
Update the AI classifier prompt with your business-specific urgent terms:
- Keywords: "URGENT", "EMERGENCY", "CRITICAL", "ASAP", "IMMEDIATE"
- Custom terms: "CLIENT ESCALATION", "SYSTEM DOWN", "LEGAL DEADLINE"
Response Templates
Customize the response generator with your company voice:
- Greeting style: "Hi [Name]" vs "Dear [Name]"
- Closing: "Best Regards" vs "Thank you" vs "Cheers"
- Company-specific phrases and terminology
Integration Options
- CRM Systems: Add nodes to create tasks in your CRM
- Project Management: Auto-create tickets in Jira, Asana, etc.
- Calendar Integration: Schedule follow-ups automatically
- Slack/Teams: Alternative notification channels
π¨ Troubleshooting
Common Issues
1. Gmail Authentication Errors
- Verify OAuth2 credentials are active
- Check Gmail API quotas
- Ensure proper scopes are configured
2. AI Classification Inconsistency
- Review and refine classification prompts
- Add more specific examples
- Adjust confidence thresholds
3. Response Generation Problems
- Validate AI model configuration
- Check API key and quotas
- Test with simpler email examples
4. Attachment Upload Failures
- Verify Google Drive permissions
- Check folder ID configuration
- Ensure sufficient storage space
5. Missing Notifications
- Test Telegram bot configuration
- Verify chat ID is correct
- Check urgency classification logic
Performance Optimization
- Rate Limiting: Gmail has API quotas - monitor usage
- Batch Processing: Workflow processes one email at a time
- Error Handling: Built-in retry logic for reliability
- Resource Management: Monitor AI API costs and usage
π Best Practices
1. Email Management
- Regular Monitoring: Review classifications weekly
- Label Hygiene: Keep Gmail labels organized
- Feedback Loop: Manually correct misclassifications
- Archive Strategy: Set up auto-archiving for processed emails
2. AI Optimization
- Prompt Engineering: Continuously refine AI instructions
- Example Training: Add specific examples for your business
- Context Limits: Monitor token usage and costs
- Model Selection: Choose appropriate AI model for your needs
3. Security Considerations
- Credential Management: Regularly rotate API keys
- Data Privacy: Review what data is sent to AI services
- Access Control: Limit workflow access to authorized users
- Audit Logging: Monitor workflow executions
4. Workflow Maintenance
- Regular Updates: Keep n8n and node versions current
- Backup Strategy: Export workflow configurations regularly
- Documentation: Keep setup notes and customizations documented
- Testing: Test major changes in development environment first
π€ Contributing to the Community
This workflow template demonstrates:
- Comprehensive AI Integration: Multiple AI touchpoints working together
- Production-Ready Architecture: Error handling, retry logic, and monitoring
- Extensive Documentation: Clear setup and customization guidance
- Flexible Configuration: Adaptable to different business needs
- Best Practice Examples: Security, performance, and maintenance considerations
π License & Support
This workflow is provided free to the n8n community under MIT License.
Community Resources:
- n8n Community Forum for questions
- GitHub Issues for bug reports
- Documentation updates welcome
Professional Support: For enterprise deployments or custom modifications, consider:
- n8n Cloud for managed hosting
- Professional services for complex integrations
- Custom AI model training for specific use cases
Transform your email workflow today! π
This AI Email Assistant reduces email processing time by up to 90% while ensuring no important message goes unnoticed. Perfect for busy professionals who want to stay responsive without being overwhelmed by their inbox.
Smart Email Manager with Gmail & GPT-4 Classification
This n8n workflow automates the process of managing incoming emails by classifying them using an AI model (GPT-4) and then taking appropriate actions, such as sending automated responses or flagging emails for human review. It helps streamline your email inbox, ensuring important emails are handled promptly and efficiently.
What it does
- Monitors Gmail: Continuously checks your specified Gmail inbox for new, unread emails.
- Extracts Email Content: Retrieves the subject, sender, and body of each new email.
- Classifies Email with AI: Uses a GPT-4 powered chain to classify the email's intent (e.g., "sales inquiry", "support request", "general feedback", "urgent", "spam").
- Routes Based on Classification:
- Urgent Emails: If classified as "urgent", it sends a notification to a Telegram chat for immediate attention.
- Sales/Support Inquiries: If classified as "sales inquiry" or "support request", it generates a draft reply using AI and saves it in Gmail.
- General Feedback: If classified as "general feedback", it creates a new file in Google Drive with the email content.
- Other/Unclassified: For any other classification, the email is marked as read without further action.
- Marks as Read: After processing, the original email in Gmail is marked as read.
Prerequisites/Requirements
- n8n Instance: A running n8n instance.
- Gmail Account: A Gmail account with appropriate permissions to read and send emails.
- OpenAI API Key: An OpenAI API key with access to GPT-4 or a compatible chat model.
- Telegram Account: A Telegram account and a bot token for sending notifications (optional, for urgent emails).
- Google Drive Account: A Google Drive account for saving general feedback (optional).
Setup/Usage
- Import the Workflow:
- Download the provided JSON file for this workflow.
- In your n8n instance, go to "Workflows" and click "New".
- Click the three-dot menu in the top right and select "Import from JSON".
- Paste the workflow JSON or upload the file.
- Configure Credentials:
- Gmail Trigger: Configure your Gmail OAuth2 credentials for the "Gmail Trigger" node. Ensure it has permissions to read and modify emails.
- OpenAI Chat Model: Provide your OpenAI API Key credential for the "OpenAI Chat Model" node.
- Telegram: If using the "Telegram" node for urgent notifications, configure your Telegram Bot API credential.
- Google Drive: If using the "Google Drive" node, configure your Google Drive OAuth2 credentials.
- Gmail (Send Draft/Mark Read): Configure your Gmail OAuth2 credentials for the "Gmail" nodes responsible for sending drafts and marking emails as read.
- Customize AI Classification:
- Review the "Basic LLM Chain" and "Structured Output Parser" nodes. You might want to adjust the prompt or the schema for the output parser to refine the classification categories and desired output format based on your specific needs.
- Adjust Logic (Optional):
- Modify the "Switch" node logic to add, remove, or change the conditions for routing emails based on the AI classification.
- Customize the actions for each branch (e.g., change the Telegram message, modify the draft email content, alter Google Drive file details).
- Activate the Workflow: Once all credentials are set up and any customizations are made, activate the workflow. It will start monitoring your Gmail inbox automatically.
Related Templates
Track competitor SEO keywords with Decodo + GPT-4.1-mini + Google Sheets
This workflow automates competitor keyword research using OpenAI LLM and Decodo for intelligent web scraping. Who this is for SEO specialists, content strategists, and growth marketers who want to automate keyword research and competitive intelligence. Marketing analysts managing multiple clients or websites who need consistent SEO tracking without manual data pulls. Agencies or automation engineers using Google Sheets as an SEO data dashboard for keyword monitoring and reporting. What problem this workflow solves Tracking competitor keywords manually is slow and inconsistent. Most SEO tools provide limited API access or lack contextual keyword analysis. This workflow solves that by: Automatically scraping any competitorβs webpage with Decodo. Using OpenAI GPT-4.1-mini to interpret keyword intent, density, and semantic focus. Storing structured keyword insights directly in Google Sheets for ongoing tracking and trend analysis. What this workflow does Trigger β Manually start the workflow or schedule it to run periodically. Input Setup β Define the website URL and target country (e.g., https://dev.to, france). Data Scraping (Decodo) β Fetch competitor web content and metadata. Keyword Analysis (OpenAI GPT-4.1-mini) Extract primary and secondary keywords. Identify focus topics and semantic entities. Generate a keyword density summary and SEO strength score. Recommend optimization and internal linking opportunities. Data Structuring β Clean and convert GPT output into JSON format. Data Storage (Google Sheets) β Append structured keyword data to a Google Sheet for long-term tracking. Setup Prerequisites If you are new to Decode, please signup on this link visit.decodo.com n8n account with workflow editor access Decodo API credentials OpenAI API key Google Sheets account connected via OAuth2 Make sure to install the Decodo Community node. Create a Google Sheet Add columns for: primarykeywords, seostrengthscore, keyworddensity_summary, etc. Share with your n8n Google account. Connect Credentials Add credentials for: Decodo API credentials - You need to register, login and obtain the Basic Authentication Token via Decodo Dashboard OpenAI API (for GPT-4o-mini) Google Sheets OAuth2 Configure Input Fields Edit the βSet Input Fieldsβ node to set your target site and region. Run the Workflow Click Execute Workflow in n8n. View structured results in your connected Google Sheet. How to customize this workflow Track Multiple Competitors β Use a Google Sheet or CSV list of URLs; loop through them using the Split In Batches node. Add Language Detection β Add a Gemini or GPT node before keyword analysis to detect content language and adjust prompts. Enhance the SEO Report β Expand the GPT prompt to include backlink insights, metadata optimization, or readability checks. Integrate Visualization β Connect your Google Sheet to Looker Studio for SEO performance dashboards. Schedule Auto-Runs β Use the Cron Node to run weekly or monthly for competitor keyword refreshes. Summary This workflow automates competitor keyword research using: Decodo for intelligent web scraping OpenAI GPT-4.1-mini for keyword and SEO analysis Google Sheets for live tracking and reporting Itβs a complete AI-powered SEO intelligence pipeline ideal for teams that want actionable insights on keyword gaps, optimization opportunities, and content focus trends, without relying on expensive SEO SaaS tools.
Generate song lyrics and music from text prompts using OpenAI and Fal.ai Minimax
Spark your creativity instantly in any chatβturn a simple prompt like "heartbreak ballad" into original, full-length lyrics and a professional AI-generated music track, all without leaving your conversation. π What This Template Does This chat-triggered workflow harnesses AI to generate detailed, genre-matched song lyrics (at least 600 characters) from user messages, then queues them for music synthesis via Fal.ai's minimax-music model. It polls asynchronously until the track is ready, delivering lyrics and audio URL back in chat. Crafts original, structured lyrics with verses, choruses, and bridges using OpenAI Submits to Fal.ai for melody, instrumentation, and vocals aligned to the style Handles long-running generations with smart looping and status checks Returns complete song package (lyrics + audio link) for seamless sharing π§ Prerequisites n8n account (self-hosted or cloud with chat integration enabled) OpenAI account with API access for GPT models Fal.ai account for AI music generation π Required Credentials OpenAI API Setup Go to platform.openai.com β API keys (sidebar) Click "Create new secret key" β Name it (e.g., "n8n Songwriter") Copy the key and add to n8n as "OpenAI API" credential type Test by sending a simple chat completion request Fal.ai HTTP Header Auth Setup Sign up at fal.ai β Dashboard β API Keys Generate a new API key β Copy it In n8n, create "HTTP Header Auth" credential: Name="Fal.ai", Header Name="Authorization", Header Value="Key [Your API Key]" Test with a simple GET to their queue endpoint (e.g., /status) βοΈ Configuration Steps Import the workflow JSON into your n8n instance Assign OpenAI API credentials to the "OpenAI Chat Model" node Assign Fal.ai HTTP Header Auth to the "Generate Music Track", "Check Generation Status", and "Fetch Final Result" nodes Activate the workflowβchat trigger will appear in your n8n chat interface Test by messaging: "Create an upbeat pop song about road trips" π― Use Cases Content Creators: YouTubers generating custom jingles for videos on the fly, streamlining production from idea to audio export Educators: Music teachers using chat prompts to create era-specific folk tunes for classroom discussions, fostering interactive learning Gift Personalization: Friends crafting anniversary R&B tracks from shared memories via quick chats, delivering emotional audio surprises Artist Brainstorming: Songwriters prototyping hip-hop beats in real-time during sessions, accelerating collaboration and iteration β οΈ Troubleshooting Invalid JSON from AI Agent: Ensure the system prompt stresses valid JSON; test the agent standalone with a sample query Music Generation Fails (401/403): Verify Fal.ai API key has minimax-music access; check usage quotas in dashboard Status Polling Loops Indefinitely: Bump wait time to 45-60s for complex tracks; inspect fal.ai queue logs for bottlenecks Lyrics Under 600 Characters: Tweak agent prompt to enforce fuller structures like [V1][C][V2][B][C]; verify output length in executions
Automate Dutch Public Procurement Data Collection with TenderNed
TenderNed Public Procurement What This Workflow Does This workflow automates the collection of public procurement data from TenderNed (the official Dutch tender platform). It: Fetches the latest tender publications from the TenderNed API Retrieves detailed information in both XML and JSON formats for each tender Parses and extracts key information like organization names, titles, descriptions, and reference numbers Filters results based on your custom criteria Stores the data in a database for easy querying and analysis Setup Instructions This template comes with sticky notes providing step-by-step instructions in Dutch and various query options you can customize. Prerequisites TenderNed API Access - Register at TenderNed for API credentials Configuration Steps Set up TenderNed credentials: Add HTTP Basic Auth credentials with your TenderNed API username and password Apply these credentials to the three HTTP Request nodes: "Tenderned Publicaties" "Haal XML Details" "Haal JSON Details" Customize filters: Modify the "Filter op ..." node to match your specific requirements Examples: specific organizations, contract values, regions, etc. How It Works Step 1: Trigger The workflow can be triggered either manually for testing or automatically on a daily schedule. Step 2: Fetch Publications Makes an API call to TenderNed to retrieve a list of recent publications (up to 100 per request). Step 3: Process & Split Extracts the tender array from the response and splits it into individual items for processing. Step 4: Fetch Details For each tender, the workflow makes two parallel API calls: XML endpoint - Retrieves the complete tender documentation in XML format JSON endpoint - Fetches metadata including reference numbers and keywords Step 5: Parse & Merge Parses the XML data and merges it with the JSON metadata and batch information into a single data structure. Step 6: Extract Fields Maps the raw API data to clean, structured fields including: Publication ID and date Organization name Tender title and description Reference numbers (kenmerk, TED number) Step 7: Filter Applies your custom filter criteria to focus on relevant tenders only. Step 8: Store Inserts the processed data into your database for storage and future analysis. Customization Tips Modify API Parameters In the "Tenderned Publicaties" node, you can adjust: offset: Starting position for pagination size: Number of results per request (max 100) Add query parameters for date ranges, status filters, etc. Add More Fields Extend the "Splits Alle Velden" node to extract additional fields from the XML/JSON data, such as: Contract value estimates Deadline dates CPV codes (procurement classification) Contact information Integrate Notifications Add a Slack, Email, or Discord node after the filter to get notified about new matching tenders. Incremental Updates Modify the workflow to only fetch new tenders by: Storing the last execution timestamp Adding date filters to the API query Only processing publications newer than the last run Troubleshooting No data returned? Verify your TenderNed API credentials are correct Check that you have setup youre filter proper Need help setting this up or interested in a complete tender analysis solution? Get in touch π LinkedIn β Wessel Bulte