0f14c001ad9437087f77f97fbd190c5fc0129678
Email Alerts System
A smart email monitoring system that automatically detects actionable emails and sends WhatsApp alerts with AI-powered analysis.
🚀 Features
- Real-time Email Monitoring: Connects to Zoho Mail API to fetch emails
- AI-Powered Analysis: Uses Groq LLM for intelligent email analysis
- Smart Triage: Identifies actionable vs non-actionable emails
- WhatsApp Alerts: Sends real-time alerts to your phone
- Thread Tracking: Monitors conversation states and timing
- Intelligent Timing: Level 1 (1-24 hours), Level 2 (24-48 hours), Level 3 (48+ hours)
- 7-Day Email Filtering: Only processes emails from the last 7 days
📁 Core System Files
email_alerts/
├── main.py # Main entry point
├── zoho_client.py # Zoho Mail API integration
├── email_triage.py # Email filtering & classification
├── thread_tracker.py # Thread state management
├── ai_analyzer.py # AI analysis & alert generation
├── whatsapp_sender.py # WhatsApp alert sending
├── email_processor.py # Main orchestration
├── requirements.txt # Python dependencies
├── .env # Environment variables
├── email_threads.db # SQLite database
├── README.md # This file
└── TWILIO_SETUP.md # WhatsApp setup guide
🛠️ Setup
-
Install Dependencies:
pip install -r requirements.txt -
Configure Environment:
cp env.example .env # Edit .env with your API keys -
Set up Zoho Mail:
- Configure Zoho email credentials in
.env - Email: projects@manaknightdigital.com
- Password: 4o%!sbk$(3!>@#567!!
- Configure Zoho email credentials in
-
Set up Twilio WhatsApp:
- Follow
TWILIO_SETUP.md - Configure WhatsApp Business API
- Follow
🚀 Usage
Run the system:
python main.py
⏰ Alert Timing
- Level 1: 1-24 hours - Initial alert
- Level 2: 24-48 hours - Urgent alert
- Level 3: 48+ hours - Critical alert
📧 Email Filtering
The system now only processes emails from the last 7 days to ensure relevance and performance.
🤖 AI Analysis
The system uses Groq LLM for intelligent email analysis:
- Real AI analysis - No mock mode, only real Groq LLM
- Smart filtering - Only alerts for emails that actually need responses
- Urgency detection - LOW/MEDIUM/HIGH/CRITICAL based on content
- Intelligent summaries - Context-aware email analysis
- Action recommendations - Specific guidance on what to do
📱 WhatsApp Alerts
Alerts include:
- Real email details (sender, subject, body)
- AI-generated summary
- Urgency level
- Required action
- Thread ID for reference
🔧 Configuration
Key environment variables:
ZOHO_EMAIL: Zoho email addressZOHO_PASSWORD: Zoho email passwordGROQ_API_KEY: Groq LLM API keyTWILIO_ACCOUNT_SID: Twilio account SIDTWILIO_AUTH_TOKEN: Twilio auth tokenTWILIO_WHATSAPP_NUMBER: Twilio WhatsApp numberWHATSAPP_TO_NUMBER: Your phone number
📊 System Architecture
Zoho Mail API → Email Triage → AI Analysis → Thread Tracking → WhatsApp Alerts
✅ Status
- ✅ Real Zoho Mail integration
- ✅ Real AI analysis (Groq LLM)
- ✅ Real WhatsApp alerts (Twilio)
- ✅ Intelligent timing system
- ✅ 7-day email filtering
- ✅ No hardcoded data
- ✅ Production ready
🔄 Migration from Gmail
The system has been successfully migrated from Gmail API to Zoho Mail API:
- Replaced
gmail_client.pywithzoho_client.py - Updated authentication to use Zoho credentials
- Maintained all existing functionality
- Added 7-day email filtering for better performance
Description
Languages
Python
63.5%
HTML
31%
Shell
5.5%