π PhoneCheckerBot A Telegram bot that checks phone numbers for validity, carrier info, and scam risk using Twilio Lookup, DuckDuckGo live search, and AI-powered analysis.
π Features β Validate numbers in E.164 format π Detect country, carrier, and line type (Mobile, Landline, VoIP) π Search web (DuckDuckGo) for scam/spam reports π€ AI-powered decision engine with risk scoring ποΈ Import personal contacts (VCF β JSON safelist) πΎ Store lookup history for quick reference π Safe number whitelist (customer support, personal contacts)
π¦ Tech Stack Python 3.11+ python-telegram-bot Twilio Lookup API httpx
- BeautifulSoup4 OpenAI (LLM-based analysis)
βοΈ Installation Clone this repo: git clone https://github.com/YOUR_USERNAME/PhoneCheckerBot.git
Create virtual environment: python3 -m venv .venv source .venv/bin/activate # Mac/Linux .venv\Scripts\activate # Windows
Install dependencies: pip install -r requirements.txt
π Setup Copy .env.example β .env and add your keys:
TELEGRAM_BOT_TOKEN=your_telegram_token TWILIO_ACCOUNT_SID=your_sid TWILIO_AUTH_TOKEN=your_auth_token OPENAI_API_KEY=your_openai_api_key
Add your safelist numbers in services/safe_numbers.json: { "+611300555123": "β SAFE β DHL Customer Service", "+611800123456": "β SAFE β NAB Bank Helpline", "+61426648942": "β SAFE β Your Personal Number" }
(Optional) Convert your contacts VCF file: python services/convert_vcf.py
π¬ Usage In Telegram: Send any phone number (must be E.164 format like +61426648942).
Bot replies with structured JSON output:
{ "number": "+61426964413", "country_code": "+61", "region": "Australia", "carrier": "Optus", "line_type": "Mobile", "sim_user": "Unknown", "spam_status": "β Safe", "risk_score": "Low" }
ποΈ Project Structure phone-checker-bot/ βββ bot.py # Main Telegram bot βββ services/ β βββ twilio_service.py # Twilio lookup β βββ ddg_service.py # DuckDuckGo scraper β βββ gpt_service.py # OpenAI risk analysis β βββ history_service.py # Save & retrieve lookups β βββ convert_vcf.py # Convert VCF contacts β JSON β βββ safe_numbers.json # Whitelisted safe numbers β βββ lookups.json # History of lookups βββ requirements.txt βββ README.md
π Deployment Local Run: Python environment (as above) Docker: Build container and run Cloud: Deploy on Oracle Cloud / AWS EC2 / Heroku / Railway
β¨ Future Improvements Web dashboard for number lookups SMS/WhatsApp integration Automatic scam database sync (e.g., Scamwatch API) Improved carrier + SIM user detection