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.
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.
- π₯ 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
| Component | Tool / Service |
|---|---|
| Automation Engine | n8n |
| Email Service | Gmail (OAuth2) |
| AI Classifier | Google Gemini (PaLM) |
| Notifications | Discord Webhook |
InboxPilot/
βββ inboxPilot.json # n8n workflow export
βββ README.md # Documentation-
Go to Google Cloud Console.
-
Create a project β Enable Gmail API.
-
Create OAuth2 credentials (Web app).
-
Add redirect URI for n8n:
http://localhost:5678/rest/oauth2-credential/callback(Adjust for your n8n host/port)
-
In n8n, create Gmail OAuth2 credential with your Client ID & Secret.
-
Connect and authorize with your Gmail account.
- Get API access for Google AI Studio.
- Create an API key.
- In n8n, add a new credential: Google Gemini (PaLM).
- The workflow uses
gemini-2.5-flash-litemodel for classification.
- Open your Discord server β Go to channel settings β Integrations β Webhooks.
- Create a webhook and copy the URL.
- In workflow, update the HTTP Request node with your webhook URL.
- Import
inboxPilot.jsoninto your n8n instance. - Configure all credentials: Gmail, Gemini, Discord.
- Adjust schedule trigger interval if needed (default: every 2 minutes).
- Activate the workflow.
-
Trigger: Runs every 2 minutes.
-
Fetch Emails: Gets the latest unread Gmail message.
-
AI Classification: Gemini assigns category (otp, finance, promotional, etc.).
-
Logic Check:
- If
promotionalβ Email is deleted. - Otherwise β Email details are formatted.
- If
-
Notification: Sends details to Discord webhook.
π€ Usama Shahid π§ Email: dev.usamashahid@gmail.com
π LinkedIn: linkedin.com/in/-usamashahid
π GitHub: github.com/fewgets
This project is for personal productivity and research use. Feel free to fork and adapt, but please credit the author π