OTP-Boss Bot is a Telegram bot integrated with Twilio Voice API and ElevenLabs Text-to-Speech API. This bot is designed for managing subscriptions, generating calls with voice messages, and handling OTP-based scenarios for authentication or verification.
-
Subscription Management
- Check subscription status.
- Add new subscriptions.
- Notify users when a subscription expires.
-
Call Functionality
- Initiate calls using Twilio API.
- Generate and play voice scripts with ElevenLabs Text-to-Speech API.
- Handle OTP verification through calls.
-
User Commands
/start
: Initiate the bot and create default user settings./check
: Check subscription status./call [Phone Number] [Name] [Code] [Company Name]
: Initiate a custom call./add_subs [User ID] [Number of Days]
: Add subscription days for a user (Admin only)./help
: List available commands.
-
Voice Interaction
- Play custom voice messages during calls.
- Support for collecting numeric input (e.g., OTP) from recipients.
-
APIs and Libraries:
- Telegram Bot Token from Telegram BotFather.
- Twilio Account SID and Auth Token from Twilio.
- ElevenLabs API Key for Text-to-Speech (ElevenLabs).
- Ngrok for exposing localhost to the web.
-
Environment Setup:
- Python 3.8 or above.
- Required Python packages listed in
requirements.txt
.
-
Configuration:
- Configuration file
conf/settings.txt
should include the following keys:{ "bot_token": "<YOUR_BOT_TOKEN>", "account_sid": "<YOUR_TWILIO_ACCOUNT_SID>", "auth_token": "<YOUR_TWILIO_AUTH_TOKEN>", "ngrok_url": "<YOUR_NGROK_URL>", "Twilio Phone Number": "<YOUR_TWILIO_PHONE_NUMBER>" }
- Configuration file
-
Download the Repository
-
Install Dependencies:
pip install -r requirements.txt
-
Set Up Configuration:
- Create the
conf/
directory and add thesettings.txt
configuration file as described above.
- Create the
-
Run the Bot:
python bot.py
-
Run the Flask Server (for handling Twilio responses):
python voice_resp.py
otp-boss-bot/
├── bot.py # Main Telegram bot script.
├── voice_resp.py # Flask server for Twilio voice responses.
├── requirements.txt # Python dependencies.
├── conf/ # Configuration files and user data.
│ ├── settings.txt # Global settings for APIs.
│ ├── <User ID>/ # User-specific data (e.g., subscriptions, audio files).
└── └── sounds/ # Common audio files for the bot.
/start
: Initialize the bot./check
: Display the subscription status./call [Phone Number] [Name] [Code] [Company Name]
: Start a call with specified details.
/add_subs [User ID] [Number of Days]
: Add subscription days to a user.
/help
: Display a list of available commands and their descriptions.
For secure handling of credentials, you can use environment variables. Update your settings.txt
to read these variables:
import os
bot_token = os.getenv("BOT_TOKEN")
account_sid = os.getenv("TWILIO_SID")
auth_token = os.getenv("TWILIO_AUTH_TOKEN")
ngrok = os.getenv("NGROK_URL")
phone_numz = os.getenv("TWILIO_PHONE_NUMBER")
- Run the bot script:
python bot.py
- Run the voice response server:
python voice_resp.py
- Use ngrok to expose the Flask app:
ngrok http 5000
- Use a platform like AWS, Heroku, or Google Cloud for hosting.
- Ensure your webhook URLs are properly configured for Telegram and Twilio.
- Multi-language support for voice scripts.
- Web-based dashboard for admin management.
- Enhanced security features, such as encrypted configurations.
Fork this repository and send pull requests and drop stars to the repo.
This project is licensed under the MIT License. See the LICENSE
file for more information.