This is a production-ready Telegram bot that automatically monitors IVASMS.com for new OTPs and sends them to a Telegram group with touch-to-copy functionality.
main.py- Flask server + Telegram bot logic with web dashboardscraper.py- IVASMS.com login and OTP extraction with robust parsingotp_filter.py- Smart duplicate detection with persistent cachingutils.py- Message formatting and utility functions
requirements.txt- All Python dependencies (Flask, python-telegram-bot, etc.).env- Environment variables (with your provided credentials).env.example- Template for environment variablesruntime.txt- Python version specification for cloud deployment
Procfile- Heroku deployment configuration.replit- Replit configuration for easy cloud hostingreplit.nix- Replit environment setup.gitignore- Git ignore file (protects sensitive data)
setup.bat- Windows automatic setup scriptsetup.sh- Linux/Mac automatic setup scriptstart.py- Quick start script with dependency checkingtest_bot.py- Comprehensive testing suite
README.md- Project overview and basic setupDEPLOYMENT.md- Detailed deployment guide for multiple platformstemplates/dashboard.html- Beautiful web dashboard for monitoring
-
✅ IVASMS Integration
- Automatic login with session management
- Robust OTP extraction from multiple page formats
- Error handling and retry logic
- Phone number and service name detection
-
✅ Telegram Bot
- Touch-to-copy OTP formatting using
<code>tags - Group message sending with HTML parsing
- Error handling and connection management
- Status and health monitoring
- Touch-to-copy OTP formatting using
-
✅ Duplicate Prevention
- Persistent JSON-based caching
- Automatic cache expiration (30 minutes)
- Smart OTP fingerprinting
- Cache statistics and management
-
✅ Flask Web Server
- Beautiful dashboard with real-time status
- RESTful API endpoints for control
- Health check endpoints for monitoring
- Background monitoring with threading
-
✅ Cloud Deployment Ready
- Replit configuration for instant deployment
- Heroku support with Procfile
- Environment variable management
- UptimeRobot integration guide
When an OTP is received, the bot sends this formatted message:
🔐 New OTP Received
🔢 OTP: 672984
📱 Number: +8801721XXXXXX
🌐 Service: Facebook
⏰ Time: 14:23:15
Tap the OTP to copy it!
The OTP code is wrapped in <code> tags making it instantly copyable by tapping in Telegram.
GET /- Web dashboard or JSON statusGET /check-otp- Manual OTP checkGET /status- Detailed bot statisticsGET /test-message- Send test messageGET /clear-cache- Clear OTP cacheGET /start-monitor- Start background monitoringGET /stop-monitor- Stop background monitoring
double-click setup.batpip install -r requirements.txt
python main.py- Upload files to Replit
- Add secrets in Replit Secrets tab
- Click Run
- Dashboard: Access
http://localhost:5000for real-time monitoring - Logs: Console output shows all bot activity
- Health Checks:
/endpoint for uptime monitoring - UptimeRobot: Ping every 5 minutes to keep bot alive
- Environment variable protection
- Session management for IVASMS
- Error handling and graceful degradation
- No hardcoded credentials in source code
- Gitignore protects sensitive files
test_bot.py- Comprehensive test suite- Import testing for all dependencies
- Environment variable validation
- Connection testing for both IVASMS and Telegram
- Sample data generation and formatting tests
- Ethical Use: Only use with your own IVASMS account
- Legal Compliance: Ensure compliance with local laws
- Rate Limiting: Bot checks every 60 seconds to avoid overloading
- Error Recovery: Automatic retry on failures
- Cache Management: OTPs expire after 30 minutes
This bot is designed to run 24/7 on cloud platforms:
- Replit: Instant deployment with web interface
- Heroku: Professional hosting with easy scaling
- Railway: Simple git-based deployment
- PythonAnywhere: Budget-friendly Python hosting
- Run
python test_bot.pyto diagnose issues - Check the
/statusendpoint for bot health - Review console logs for detailed error information
- Verify environment variables are correctly set
Your Telegram OTP bot is complete and ready for production use. All components have been implemented according to your specifications with additional features for reliability and monitoring.
Next Steps:
- Install dependencies:
pip install -r requirements.txt - Run tests:
python test_bot.py - Start bot:
python main.py - Deploy to Replit for 24/7 operation
- Set up UptimeRobot monitoring
The bot will automatically:
- Monitor IVASMS for new OTPs every 60 seconds
- Send formatted messages to your Telegram group
- Prevent duplicate OTP notifications
- Provide a web dashboard for monitoring
- Handle errors gracefully and continue running
This is a complete, professional-grade solution ready for immediate deployment! 🚀