Managing emails can be exhausting — especially when it involves repetitive tasks like sorting, replying, or adding deadlines to a calendar.
So I built an AI-powered email automation system using Python, Cohere, and Gmail API that does all of this for me — and sends me Telegram alerts for important tasks.
In this post, I’ll walk you through:
- How I built it
- The tools I used
- How it works behind the scenes
- My future plans for improvement
Features Overview
- Classifies incoming emails: important, junk, reply needed, deadline, etc.
- Suggests AI-generated replies
- Creates Google Calendar events for deadlines
- Sends Telegram alerts for urgent tasks
- Logs everything to emails.json for tracking
Tech Stack Used
- Python
- Gmail API (for reading/sending/deleting emails)
- Cohere AI (for email classification + reply generation)
- Google Calendar API (for deadline events)
- Telegram Bot API (for alerts)
- Docker + Ngrok (for deployment/exposing locally)
System Architecture Diagram
Gmail → Cohere (HTTP request) → JSON output →
- Draft email → Gmail API
- Create event → Calendar API
- Alert → Telegram API
Folder Structure
ai_email_automator/
├── auth/
│ └── gmail_auth.py
├── classification/
│ └── cohere_classifier.py
├── automation/
│ ├── gmail_reader.py
│ └── gmail_actions.py
├── telegram/
│ └── telegram_bot.py
├── calendar/
│ └── google_calendar.py
├── main.py
├── emails.json
└── Dockerfile
Final Output
What’s Next / Future Plans
- Frontend dashboard for controlling rules
- Slack or WhatsApp integration
- Visual flow builder
- Google Sheets project tracking
Conclusion
This project taught me how powerful automation + LLMs can be in boosting productivity. I now spend far less time triaging my inbox, and get instant alerts for anything urgent.
Feel free to check out the GitHub repo (linked below), suggest improvements, or fork it to make your own version!
GitHub Repo: github.com/Armaan-Sharma12/AI-Email-AutomationLet me know your thoughts or if you’d like help building something similar.
Top comments (0)