A sophisticated AI-powered message forwarding system that intelligently automates cross-platform communication using advanced web automation and machine learning capabilities.
The Message Auto-Forwarding AI Agent is an enterprise-grade solution designed to streamline communication workflows across multiple messaging platforms. By leveraging Selenium-based web automation and intelligent filtering algorithms, this system provides seamless message routing with minimal manual intervention.
┌─────────────────────────────────────────────────────────────────────────────────┐
│ USER INTERFACE LAYER │
├─────────────────┬─────────────────┬─────────────────┬─────────────────────────┤
│ Web Dashboard │ REST API │ CLI Interface │ WebSocket Server │
└─────────────────┴─────────────────┴─────────────────┴─────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────────┐
│ APPLICATION LAYER │
├─────────────────┬─────────────────┬─────────────────┬─────────────────────────┤
│ Authentication │ Rule Engine │ Task Scheduler │ AI Processing Engine │
│ Service │ │ │ │
└─────────────────┴─────────────────┴─────────────────┴─────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────────┐
│ CORE SERVICES │
├─────────────────┬─────────────────┬─────────────────┬─────────────────────────┤
│ Message Handler │ Filter Engine │ Message Router │ Health Monitor │
│ │ │ │ │
└─────────────────┴─────────────────┴─────────────────┴─────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────────┐
│ PLATFORM CONNECTORS │
├─────────────────┬─────────────────┬─────────────────┬─────────────────────────┤
│ Telegram │ WhatsApp │ Slack │ Discord │
│ Connector │ Connector │ Connector │ Connector │
└─────────────────┴─────────────────┴─────────────────┴─────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────────┐
│ DATA LAYER │
├─────────────────┬─────────────────┬─────────────────┬─────────────────────────┤
│ PostgreSQL │ Redis Cache │ Log Storage │ File Storage │
│ Database │ │ │ │
└─────────────────┴─────────────────┴─────────────────┴─────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────────┐
│ EXTERNAL PLATFORMS │
├─────────────────┬─────────────────┬─────────────────┬─────────────────────────┤
│ Telegram │ WhatsApp Web │ Slack Workspace │ Discord Server │
│ API │ │ │ │
└─────────────────┴─────────────────┴─────────────────┴─────────────────────────┘
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Source Platform│ │ Platform │ │ AI Content │
│ │───▶│ Connector │───▶│ Analyzer │
│ • Telegram │ │ │ │ │
│ • WhatsApp │ │ • Extract │ │ • Classification│
│ • Slack │ │ • Parse │ │ • Sentiment │
│ • Discord │ │ • Normalize │ │ • Priority │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Target Platform │ │ Message │ │ Filter Engine │
│ │◀───│ Router │◀───│ │
│ • Telegram │ │ │ │ • Keyword Match │
│ • WhatsApp │ │ • Queue │ │ • Sender Rules │
│ • Slack │ │ • Retry │ │ • Time Windows │
│ • Discord │ │ • Track │ │ • Custom Logic │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ MONITORING & LOGGING │
├─────────────────┬─────────────────┬─────────────────────────────┤
│ Delivery Status │ Performance │ Error Tracking & Analytics │
│ • Success/Fail │ • Latency │ • Failed Messages │
│ • Retry Count │ • Throughput │ • System Health │
│ • Timestamps │ • Queue Size │ • Usage Statistics │
└─────────────────┴─────────────────┴─────────────────────────────┘
INPUT SOURCES PROCESSING PIPELINE OUTPUT DESTINATIONS
┌─────────────┐ ┌─────────────────────┐ ┌─────────────┐
│ Telegram │────────────▶│ │───────────▶│ Telegram │
│ Messages │ │ Message │ │ Channels │
└─────────────┘ │ Ingestion │ └─────────────┘
│ │
┌─────────────┐ │ ┌─────────────────┐ │ ┌─────────────┐
│ WhatsApp │────────────▶│ │ AI Analysis │ │───────────▶│ WhatsApp │
│ Messages │ │ │ • NLP │ │ │ Contacts │
└─────────────┘ │ │ • Classification│ │ └─────────────┘
│ │ • Sentiment │ │
┌─────────────┐ │ └─────────────────┘ │ ┌─────────────┐
│ Slack │────────────▶│ │───────────▶│ Slack │
│ Messages │ │ ┌─────────────────┐ │ │ Channels │
└─────────────┘ │ │ Rule Engine │ │ └─────────────┘
│ │ • Conditions │ │
┌─────────────┐ │ │ • Filters │ │ ┌─────────────┐
│ Discord │────────────▶│ │ • Routing Logic │ │───────────▶│ Discord │
│ Messages │ │ └─────────────────┘ │ │ Servers │
└─────────────┘ │ │ └─────────────┘
│ ┌─────────────────┐ │
│ │ Priority Queue │ │
│ │ • High Priority │ │
│ │ • Normal Queue │ │
│ │ • Retry Queue │ │
│ └─────────────────┘ │
└─────────────────────┘
│
▼
┌─────────────────────┐
│ STORAGE & ANALYTICS │
├─────────────────────┤
│ • Message Logs │
│ • Performance Data │
│ • Error Reports │
│ • Usage Statistics │
└─────────────────────┘
WEB INTERFACE API LAYER BUSINESS LOGIC
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Dashboard │◀───────────▶│ REST API │◀──────────▶│ Rule Engine │
│ UI │ │ Endpoints │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Config │◀───────────▶│ WebSocket │◀──────────▶│ AI │
│ Panel │ │ Handler │ │ Processor │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Analytics │◀───────────▶│ Webhook │◀──────────▶│ Job │
│ View │ │ Receiver │ │ Scheduler │
└─────────────┘ └─────────────┘ └─────────────┘
│
▼
INTEGRATION LAYER STORAGE LAYER
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Selenium │ │ Telegram │ │ Slack API │ │ PostgreSQL │
│ WebDriver │ │ Bot API │ │ Client │ │ Database │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
│ │ │ │
└────────────────┼────────────────┘ │
│ │
┌─────────────┐ ┌─────────────┐
│ Discord API │ │ Redis │
│ Client │ │ Cache │
└─────────────┘ └─────────────┘
│
┌─────────────┐
│ File │
│ Storage │
└─────────────┘
- Smart Content Analysis: AI-driven message classification and routing
- Context-Aware Filtering: Intelligent message prioritization based on content and sender patterns
- Adaptive Learning: System improves forwarding accuracy over time
- Telegram: Full API integration with bot support
- WhatsApp: Web-based automation with message parsing
- Slack: Workspace integration with channel management
- Discord: Server and DM forwarding capabilities
- Rule-Based Forwarding: Create complex forwarding rules with conditional logic
- Keyword Filtering: Advanced pattern matching and regex support
- Sender Whitelisting/Blacklisting: Granular control over message sources
- Time-Based Scheduling: Configure forwarding windows and frequency limits
- Web Dashboard: Intuitive interface for configuration and monitoring
- Real-Time Analytics: Message flow statistics and performance metrics
- Comprehensive Logging: Detailed audit trails with error tracking
- Health Monitoring: System status and platform connectivity checks
- Backend Framework: Flask (Python 3.8+)
- Database: PostgreSQL with SQLAlchemy ORM
- Web Automation: Selenium WebDriver with Chrome/Firefox support
- Task Scheduling: APScheduler for robust job management
- Frontend: Bootstrap 5, Chart.js for analytics
- Security: JWT authentication, encrypted credential storage
- Python: 3.8 or higher
- Database: PostgreSQL 12+
- Browser: Chrome 90+ or Firefox 88+
- Memory: Minimum 2GB RAM recommended
- Storage: 1GB free space for logs and temporary files
-
Clone the repository
git clone https://github.com/bigdata5911/Message-Auto-Forwarding-AI-Agent.git
-
Navigate to project directory
cd Message-Auto-Forwarding-AI-Agent
-
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
export DATABASE_URL="postgresql://username:password@localhost:5432/message_forwarder" export SESSION_SECRET="your-secure-session-key-here" export FLASK_ENV="production" export LOG_LEVEL="INFO"
-
Initialize database
python -c "from app import create_app, db; app = create_app(); app.app_context().push(); db.create_all()"
-
Configure WebDriver
- Download ChromeDriver or GeckoDriver
- Add driver executable to PATH or specify path in configuration
-
Start the application
python main.py
-
Access the web interface
- Open your browser and navigate to
http://localhost:5000
- Complete the initial setup wizard
- Configure your messaging platforms
- Open your browser and navigate to
- Navigate to Platform Configuration
- Add New Platform: Select from supported platforms
- Authentication: Follow platform-specific authentication steps
- Test Connection: Verify connectivity before proceeding
- Access Rules Management
- Define Source and Destination: Select platforms and channels
- Set Filters: Configure keyword filters, sender rules, and conditions
- Schedule: Set forwarding frequency and time windows
- Activate Rule: Enable the forwarding rule
- Dashboard: Real-time message flow statistics
- Logs: Detailed forwarding history and error reports
- Performance: System health and response time metrics
The system provides RESTful APIs for programmatic access:
GET /api/platforms
- List configured platformsPOST /api/rules
- Create forwarding rulesGET /api/logs
- Retrieve forwarding logsGET /api/health
- System health check
Full API documentation available at /api/docs
when running.
- Credential Encryption: All platform credentials are encrypted at rest
- Secure Sessions: JWT-based authentication with configurable expiration
- Rate Limiting: Built-in protection against API abuse
- Audit Logging: Comprehensive security event logging
WebDriver Connection Errors
- Ensure browser and driver versions are compatible
- Check that the driver executable is in PATH
Database Connection Issues
- Verify PostgreSQL service is running
- Check DATABASE_URL format and credentials
Platform Authentication Failures
- Review platform-specific authentication requirements
- Check for expired tokens or changed credentials
We welcome contributions! Please see our Contributing Guidelines for details on:
- Code style and standards
- Pull request process
- Issue reporting
- Development setup
This project is licensed under the MIT License - see the LICENSE file for details.
See CHANGELOG.md for a detailed history of changes and updates.