first commit
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
# 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
|
||||
|
||||
1. **Install Dependencies**:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
2. **Configure Environment**:
|
||||
```bash
|
||||
cp env.example .env
|
||||
# Edit .env with your API keys
|
||||
```
|
||||
|
||||
3. **Set up Zoho Mail**:
|
||||
- Configure Zoho email credentials in `.env`
|
||||
- Email: projects@manaknightdigital.com
|
||||
- Password: 4o%!sbk$(3!>@#567!!
|
||||
|
||||
4. **Set up Twilio WhatsApp**:
|
||||
- Follow `TWILIO_SETUP.md`
|
||||
- Configure WhatsApp Business API
|
||||
|
||||
## 🚀 Usage
|
||||
|
||||
Run the system:
|
||||
```bash
|
||||
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 address
|
||||
- `ZOHO_PASSWORD`: Zoho email password
|
||||
- `GROQ_API_KEY`: Groq LLM API key
|
||||
- `TWILIO_ACCOUNT_SID`: Twilio account SID
|
||||
- `TWILIO_AUTH_TOKEN`: Twilio auth token
|
||||
- `TWILIO_WHATSAPP_NUMBER`: Twilio WhatsApp number
|
||||
- `WHATSAPP_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.py` with `zoho_client.py`
|
||||
- Updated authentication to use Zoho credentials
|
||||
- Maintained all existing functionality
|
||||
- Added 7-day email filtering for better performance
|
||||
Reference in New Issue
Block a user