Skip to content

A local AI-powered agent built with n8n that automatically classifies incoming emails into Important or Unimportant, and routes the junk toward Trash to keep your inbox clean.

Notifications You must be signed in to change notification settings

21Afnan/Inbox_Guardian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¬ InboxGuardian

InboxGuardian is a local AI-powered email cleaner built with n8n.
It automatically scans your inbox on a schedule, classifies emails with AI, and then:

  • βœ… Sends important emails as notifications via Discord
  • πŸ—‘οΈ Automatically deletes unimportant emails from Gmail

Runs fully on your machine β†’ your data stays private.


πŸš€ How It Works

  1. Scheduler Trigger β†’ runs the workflow at intervals you define
  2. Gmail Get Message Node β†’ fetches unread emails
  3. AI Classifier (Gemini 2.5 Flash Lite) β†’ analyzes & labels emails as KEEP or DELETE
  4. Code Node β†’ parses AI output into JSON
  5. IF Node β†’ routes based on classification:
    • KEEP β†’ sends you a notification in Discord via webhook
    • DELETE β†’ removes the message using Gmail Delete Message Node

πŸ“‚ Repository Structure

β”œβ”€ inboxguardian-workflow.json # exported n8n workflow
β”œβ”€ screenshots/ # workflow visuals
β”‚ └─ inboxguardian-flow.png # screenshot of workflow
  └─ demo.mp4 # short demo video (download & open locally)
β”œβ”€ README.md # project description & instructions
└─ .gitignore # ignores sensitive files

## πŸ› οΈ Run Locally with Docker  

### 1. Install Docker Desktop  
- Download & install [Docker Desktop](https://www.docker.com/products/docker-desktop/)  
- Start Docker Desktop  

### 2. Verify Installation  
Run this command in terminal/PowerShell:  

docker --version

### 3.Create a folder on your machine to persist workflow data (Windows example):
mkdir D:\N8N\inboxguardian

### 4. Run InboxGuardian
Start n8n with the following command:
docker run -it -p 5678:5678 ^
  -v D:\N8N\inboxguardian:/home/node/.n8n ^
  n8nio/n8n
   ### πŸ’‘ Replace D:\N8N\inboxguardian with your local folder path if different.

### 5. Open n8n
Once the container is running, open:
πŸ‘‰ http://localhost:5678

πŸ”‘ Setup Credentials

Gmail

  • In n8n, create new Gmail credentials (OAuth2 or service account)

  • Allow read + delete access

  • Discord Webhook

  • Go to your Discord server β†’ Integrations β†’ Webhooks

  • Copy webhook URL and paste into the Discord node in n8n

  • AI Classifier

  • Replace with your own Gemini API Key (from Google AI Studio ) in the workflow

Import Workflow

  • In n8n, click Import from File

  • Upload inboxguardian-workflow.json

  • Update credentials with yours

  • Save & activate

πŸ–ΌοΈ Workflow Preview

πŸ“Έ Screenshot: See screenshots/inboxguardian-flow.png

πŸŽ₯ Video Demo: Watch inboxguardian.mp4

πŸ”” Features

  • πŸ•’ Runs on schedule – no IMAP connection needed
  • πŸ“¨ Connect Gmail node (Get Message)
  • πŸ€– Smart AI classification using Gemini 2.5 Flash Lite
  • πŸ“¨ Important emails β†’ instant Discord alerts
  • πŸ—‘οΈ Junk emails β†’ auto-deleted from Gmail
  • πŸ”’ Local setup β†’ you control your data
### βœ… Quick Start:
Clone the repo, run Docker, import the workflow, add your credentials β†’ InboxGuardian is ready πŸš€

git clone https://github.com/YOUR-USERNAME/inboxguardian.git
cd inboxguardian
docker run -it -p 5678:5678 -v %cd%:/home/node/.n8n n8nio/n8n

πŸ“© Connect with me:

About

A local AI-powered agent built with n8n that automatically classifies incoming emails into Important or Unimportant, and routes the junk toward Trash to keep your inbox clean.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published