ActionAlert-AI
An intelligent email classification and prioritization system that analyzes incoming messages to automatically surface high-priority action items using ML text models and a high-performance FastAPI backend.
FastAPIScikit-LearnGeminiGmail APIPostgreSQLTelegram
The problem
During engineering I got a constant stream of assignment emails, and with my inbox storage filling up fast, deadlines kept slipping past me. I needed something that would read my inbox for me and only interrupt me when something was actually due.
0
Hand-labelled training emails
0h
Alert window before a deadline
0 days
Default data retention
How it works
- Fetch the latest emails from Gmail using read-only OAuth access.
- Classify each email as urgent or not urgent with a TF-IDF + Logistic Regression model, along with a confidence score.
- For urgent emails only, ask Gemini to extract the deadline and a list of action items as structured JSON.
- If the deadline is within 24 hours, push a Telegram alert to my phone, sent once per email.
- Save everything to Postgres and show it in an inbox dashboard with filters and urgent-row highlighting.
Technical highlights
- Two-stage pipeline: a lightweight scikit-learn model triages every email, and the Gemini API is called only for urgent ones, which keeps API usage low.
- Storage layer runs the same SQL on Postgres (Neon) in production and SQLite locally, picked automatically from the environment.
- The /classify endpoint is public so anyone can try the model, while inbox routes are locked behind an owner password header.
- Runs on Render's free tier, with a cron job checking the inbox every 30 minutes so alerts arrive without opening the dashboard.
- Old emails are cleaned up automatically after a configurable retention period (30 days by default).
What I'd improve next
- Label more emails. The training set is small, so confidence scores are only a rough signal.
- Get the Google OAuth app verified so people other than me can connect their inbox.
- Add a Telegram bot that classifies any email you paste into the chat.
- Migrate from google-generativeai to the newer google-genai SDK.
Live preview
If the preview doesn’t load, the site may block embedding. Click Live Demo to open in a new tab.