Telegram Bot Configuration¶
Required Settings¶
| Setting | Source | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Environment variable or Settings page | Bot token from @BotFather. Required. |
TELEGRAM_BOT_NAME |
Environment variable or Settings page | Display name for the bot (informational only). Optional. |
Getting a Bot Token¶
- Open Telegram and message @BotFather
- Send
/newbotand follow the prompts to name your bot - BotFather gives you a token like
123456789:ABCdefGHI... - Enter this token in the Settings page under the Telegram section, or set it as the
TELEGRAM_BOT_TOKENenvironment variable
Setting the Token¶
From the Settings Page¶
- Go to Settings (
/admin/settings) - Find the Telegram section
- Enter the bot token
- Click Start to start the bot
As an Environment Variable¶
Set TELEGRAM_BOT_TOKEN when creating your RunPod pod or Docker container. The bot will auto-start on backend boot.
Runtime Settings Storage¶
When edited from the Settings page, the token is persisted in both:
os.environ(for the current process)- The SQLite database (
database/studio.dbsettings table) -- survives pod restarts
On subsequent boots, the backend loads saved settings from the database before auto_start() checks for the token.
Bot Control Endpoints¶
| Endpoint | Method | Description |
|---|---|---|
GET /api/admin/telegram/status |
GET | Returns {running, name, started_at} |
POST /api/admin/telegram/start |
POST | Start the bot (returns "started", "already running", or "no token configured") |
POST /api/admin/telegram/stop |
POST | Stop the bot |