Skip to content

Smart Gmail automation with n8n that classifies emails using Gemini AI, deletes promotions, and forwards important alerts to Discord.

Notifications You must be signed in to change notification settings

fewgets/InboxPilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¬ InboxPilot - Smart Email Classifier & Cleaner (n8n + Gemini AI)

InboxPilot is an automation workflow built in n8n that uses Google Gemini AI to classify incoming Gmail messages, automatically delete unwanted promotional emails, and forward important email details to Discord for instant notifications.


πŸ“Œ Project Summary

InboxPilot connects to Gmail, scans unread messages, and passes them to Google Gemini for classification. Emails are categorized into otp, security_alert, career, finance, transactional, personal, promotional, other.

  • If classified as promotional β†’ the email is automatically deleted.
  • Otherwise β†’ a notification with details (sender, subject, reason) is sent to a Discord channel.

This workflow runs every 2 minutes via a schedule trigger, keeping your inbox clean and important messages visible.


βš™οΈ Features

  • πŸ“₯ Fetch Unread Emails from Gmail
  • 🧠 AI-Powered Classification using Google Gemini
  • πŸ—‘ Auto-Delete Promotional Emails
  • πŸ”” Discord Notifications for important emails
  • ⏳ Scheduled Execution every 2 minutes
  • ⚑ 100% Automated, runs in the background

🧰 Tech Stack

Component Tool / Service
Automation Engine n8n
Email Service Gmail (OAuth2)
AI Classifier Google Gemini (PaLM)
Notifications Discord Webhook

πŸ—‚ Folder Structure

InboxPilot/
β”œβ”€β”€ inboxPilot.json     # n8n workflow export
└── README.md           # Documentation

πŸ“ Setup Instructions

1) Gmail API (OAuth2)

  1. Go to Google Cloud Console.

  2. Create a project β†’ Enable Gmail API.

  3. Create OAuth2 credentials (Web app).

  4. Add redirect URI for n8n:

    http://localhost:5678/rest/oauth2-credential/callback
    

    (Adjust for your n8n host/port)

  5. In n8n, create Gmail OAuth2 credential with your Client ID & Secret.

  6. Connect and authorize with your Gmail account.


2) Google Gemini (AI Model)

  1. Get API access for Google AI Studio.
  2. Create an API key.
  3. In n8n, add a new credential: Google Gemini (PaLM).
  4. The workflow uses gemini-2.5-flash-lite model for classification.

3) Discord Webhook

  1. Open your Discord server β†’ Go to channel settings β†’ Integrations β†’ Webhooks.
  2. Create a webhook and copy the URL.
  3. In workflow, update the HTTP Request node with your webhook URL.

4) n8n Workflow Setup

  1. Import inboxPilot.json into your n8n instance.
  2. Configure all credentials: Gmail, Gemini, Discord.
  3. Adjust schedule trigger interval if needed (default: every 2 minutes).
  4. Activate the workflow.

πŸš€ How It Works

  1. Trigger: Runs every 2 minutes.

  2. Fetch Emails: Gets the latest unread Gmail message.

  3. AI Classification: Gemini assigns category (otp, finance, promotional, etc.).

  4. Logic Check:

    • If promotional β†’ Email is deleted.
    • Otherwise β†’ Email details are formatted.
  5. Notification: Sends details to Discord webhook.


πŸ“© Contact

πŸ‘€ Usama Shahid πŸ“§ Email: dev.usamashahid@gmail.com

πŸ”— LinkedIn: linkedin.com/in/-usamashahid

πŸ™ GitHub: github.com/fewgets


πŸ“œ License

This project is for personal productivity and research use. Feel free to fork and adapt, but please credit the author πŸ™

About

Smart Gmail automation with n8n that classifies emails using Gemini AI, deletes promotions, and forwards important alerts to Discord.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published