Day 20Productivity & FinanceGmailTelegramClassification

AI Inbox Chief of Staff — AI Agent for Gmail intent triage

Protects founder time by triaging urgent Gmail intent.

Impact

Protects founder time by triaging urgent Gmail intent.

Mechanism

Gmail Intent Classifier

DAY 20
Full README · Case Study
The "Executive Assistant" workflow that reads, sorts, and answers your emails 24/7.



See the Flow •
Key Features •
Prompt Lab •
Deploy

🤯 The "Why"

"Be honest — how many times have you opened your inbox and instantly felt overwhelmed?"

It’s not the volume. It’s the decision fatigue. Every unread email is a micro-decision waiting to be made.

  • "Is this urgent?"

  • "Is this spam?"

  • "Do I need to pay this?"

      🛑 OLD WAY (Manual Pilot)
      ✅ NEW WAY (AI Pilot)
    
    
    
    
    
      
        ❌ Mental Load: High. 
    
        ❌ Response: Hours/Days. 
    
        ❌ Stress: Constant.
      
      
        🧠 Mental Load: Zero. 
    
        ⚡ Response: Seconds. 
    
        🧘 State: Zen.
      
    

✨ Key Features

🧠 Contextual Understanding

  Doesn't just keyword match. It reads the entire email body to understand sentiment, intent, and urgency.



  

⚡ Instant Classification

  Sorts emails into Priority, Support, Finance, or Promo within seconds of arrival.






  

✍️ Human-Like Drafting

  Pre-writes replies in your tone. You just review and hit send. Zero writing required.



  

🛡️ Spam Shield

  Identifies sophisticated spam that bypasses Gmail's default filters.


🧩 The Workflow Visualized

This is not just a script. It's a cognitive architecture running on n8n.

New Unread Email

Urgent Request

Apply Label

Executive Asst Persona

Customer Issue

Apply Label

Support Rep Persona

Invoice/Bill

Apply Label

Finance Asst Persona

To: Finance Dept

Marketing

Apply Label

📩 Gmail Trigger

🧠 AI Classifier

🔥 High Priority

🛠️ Support

💰 Finance

📢 Promotion

✍️ Draft Reply

↩️ Auto-Reply

📝 Summary

📨 Forward Email

Draft Ready

Sent Reply

Forwarded

Summarized


📂 Repository Structure

A clean look at what resides in this repo.

bash
ai-inbox-automation/
├── README.md                 # 📖 You are reading this
├── JUx2ZfNfD64 - 1.json      # 🧠 The Master Workflow (Import this!)
└── assets/                   # 🖼️ Images & Icons
    └── banner.gif            #    (Header Animation)

🧠 Prompt Engineering Lab

This agent isn't just "calling GPT". It uses Role-Based Prompting to switch personas.

🕵️ The Classifier (The Brain)

"Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json."

Categories Defined:

High Priority: Urgent, key stakeholders, deadlines.

Customer Support: Service requests, feedback.

Promotions: Marketing, newsletters.

Finance/Billing: Invoices, receipts.

👔 The Executive Assistant (High Priority)

"You are an executive assistant. Your job is to respond to incoming high priority inquiries as accurately as you can."

(Generates a draft response for your review)

🎧 The Support Rep (Customer Service)

"You are a customer service representative. Your job is to respond to incoming customer support inquiries as accurately as you can, and if it is an inquiry you cannot handle, please refer the user to the following email: customersupport@abccorp.com"

(Sends an automatic reply immediately)

💼 The Accountant (Finance)

"You are a finance/billing assistant. Your job is to summarize incoming emails relating to finance and billing and summarize them in a short and concise way."

(Summarizes and forwards the email)


🚀 Setup Guide (5 Minutes)

1. Pre-Flight Check 📋

  • n8n Instance: Running on Cloud or Self-Hosted.
  • OpenAI Key: Needs gpt-4o access.
  • Gmail Account: Accessible via OAuth2.

2. Import & Config 📥

  1. Download the JSON file from this repo.
  2. Import into n8n.
  3. Credentials: You will see nodes asking for credentials.
    • Gmail account 2: Create a new Gmail OAuth2 credential.
    • OpenAi account 2: Enter your OpenAI API Key.

3. Critical Customization ⚠️

The workflow has some hardcoded values you MUST change for it to work for you:

Node NameSetting to ChangeCurrent Value (CHANGE THIS)
Send to Finance DeptTo Emailuppitdigital@gmail.com
Gmail TriggerPoll TimeEvery Minute (Adjust if needed)
Creating EmailSystem Promptcustomersupport@abccorp.com

Node-by-Node Explanation

1. Gmail Trigger (Gmail Trigger)

  • Role: The Watchdog.
  • Settings: Polls every 1 minute.
  • Why: Ensures we only process new, unseen emails.

2. Text Classifier (Text Classifier)

  • Role: The Router.
  • Logic: Uses a specific schema to map email content to one of 4 keys.

3. OpenAI Chat Model

  • Role: The Brain.
  • Model: gpt-4o.
  • Reasoning: We need high intelligence to distinguish between a "Support Request" and a "Support Complaint" (Priority).

4. Action Nodes

  • Creating Draft (GPT): Generates a human-like response.
  • Draft (Gmail): Saves that response to your drafts folder.
  • Auto Reply (Gmail): Automatically replies to the thread.

❓ Frequently Asked Questions

Q: Does this cost money to run?

A: Yes.

  1. n8n: Free if self-hosted.
  2. OpenAI: You pay per 1k tokens.

Q: Is it safe to give n8n access to my Gmail?

A: If you self-host n8n, yes. The data never leaves your server except to go to OpenAI for processing.


🛡️ Privacy & Security Policy

Your email data is sensitive. Here is how this workflow handles it:

  1. Data Transmission: Email bodies are sent to OpenAI API.
  2. Storage: n8n stores execution logs (inputs/outputs).
  3. Access Control: The Gmail Credential has read/write access.

Built for the "30 Days of AI Agents" Challenge

Explore more agents

30 open-source systems · full registry

Browse All 30 Agents