Overview
This is a complete automated Email classification, prioritization and response system using n8n. It’s smart enough to know how it should respond for each and every email you receive. By processing your incoming Gmail mails instantly, assessing their importance and organizing them into appropriate actionable groups as well as providing the right follow ups writing a response, marking a message as important or filing it away in just few clicks.
Objective
The primary job of the AI Email Assistant Bot Workflow is to automate the email workflow i.e drafting, categorization and answers which will lead to quicker responses of your emails.
More Often than always all these actions are important as they help in automation which helps enable faster response times better accuracy less manual work and help you and organization save time.
How does it work?
Step 1: Email Trigger (Gmail)
- Node: Gmail Trigger
- Objective: Checks the label of the linked Gmail to see if there are any new emails received.
- Output: Details like subject, from address, body and attachment content is extracted to push through to other steps.
Step 2: Get Priority Email List
- Node: Google Sheets (Get Rows)
- Objective: Reads a reference sheet named Priority Emails that lists the important email addresses.
- Usage: This information is then used to test if an incoming email came from a priority sender.

Step 3: Importance Classification
- Node: Code Node (JavaScript)
- Logic: If the sender’s email address and body contains details from the list (pulled in from Google Sheets) and a set of predefined Keywords in an array.
- Result:
- If the selected targeted email meets specified criteria, tags the email with “imp” (Important).
- Tag it as “not imp” (Not Important) if they don’t match.
Step 4: If Node – Importance Check
- Function: Determines if an email is significant or not.
- Process: If imp: Workflow proceeds for further processing.
- If Not Important (not imp): Label as “Not Important” directly in gmail using a messageID.
Step 5: Add Critical Emails to the “Email Data” Sheet
- Node: Google Sheets (Append Row).
- Objective: Store important email info for tracking.
- Saved Details: Date, Sender, Subject and Body into the sheet “Email Data”.

Step 6: AI Email Categorization
Takes it even further to categorise the imp mails for well informed decisions:
- Node: AI Agent (Google Gemini cloud chat model)
- Prompt:
- Tells the AI to categorize the email into one of the following:
- To Reply
- Handled by Assistant
- Urgent Today
- Internal Tasks
- Needs Follow-Up
- No-Need to Reply
- Contains rules from all categories to correctly classify and dismiss personal desires or responses except when needed.
- For the categories of “To Reply”, “Handled by Assistant” or “Urgent today”, an additional polite draft reply will, however, also be generated by AI.
- Tells the AI to categorize the email into one of the following:
- Output Format:

Step 7: AI Output Parsing
- Node: Code Node
- Goal: Clean AI JSON Output and fetch details
- Category
- Reply (if applicable)
Step 8: Switch Node – Category Routing
- Goal: Depending on what the AI believes is appropriate action, route email.
Step 9: Standard Labeling
- Applicable Categories:
- “To Reply”
- “No-Need to Reply”
- “Internal Tasks”
- “Needs Follow-Up”
- Action:
- Applies a Gmail label for each category.
- It also drafts for To-Reply.
Step 10: Urgent Today Handling
- Action:
- Adds “Urgent Today” Gmail label.
- Adds the email details and the AI draft reply to a “Urgent Today” tab in our Google Sheet.
Step 11: Handled by Assistant – Sub classification
- Node: Code Node
- This will further categorize “Handled by Assistant” to:
- Calendar Scheduling Assistance
- Forward Email Attachments to Google Drive
Step 12: Switch Node – Assistant to Task Routing
- Routes:
- Calendar scheduling (manages scheduling, rescheduling and confirmation mail)
- It fetches the reserved slots from Google Calendar.
- Slot Data Parser in Code Node.
- For generating the scheduling reply, the slot data and the email data are transmitted to AI Agent.
- If you have AI data scraped functions and you would like to convert them to Gmail response format, this function will help
- Save Email Attachments to Google Drive
- Removes all attachments and file details.
- Uploads them to a specific Google Drive folder(Folder Name: Automatic Downloads).
- Calendar scheduling (manages scheduling, rescheduling and confirmation mail)
Step 13: Not Important Emails
- Action: Apply label directly to thread instead of going through with further processing.
Technology Stack Included
Key Benefits
Smart Email Prioritization
Automatically prioritize and process important email based on sender check list and keywords.
Time-Saving Automation
No more manual triaging, emails are automatically sorted, labeled and interpreted by AI.
AI-Powered Categorization
Leverages the Gemini cloud chat AI model to categorize emails into actionable suggestions, and even draft replies as needed.
Multi-Action Assistant Handling
Automatically finds free slots in your calendar and mails you a suitable reply. Reshelves attachments on Google Drive automatically, without the need for human action.
Centralized Record-Keeping
Records all the important and priority emails to Google Sheets for easy lookup and monitoring
Reduced Response Delays
Only important emails are starred/recorded to follow up on them later and are taken care of right now.
Closure
Complete automation email classification, prioritization and response system using n8n helps in less manual work and help you and organization save time. All these actions are important as they help in automation which helps enable faster response times and better accuracy.