Telegram Bot
Check links from groups, channels, and DMs in real time.
How it works
Message the bot, add it to a group, or add it to a channel as an administrator. It scans every URL shared in that chat and posts a verdict — malicious (≥ 70), suspicious (40–69), or safe. When enabled, confirmed malicious messages are deleted — provided the bot holds the rights to do so.
In agent mode the bot confirms installation with /start and starts scanning that chat. Configuration happens in chat, not config files.
Install
Create the bot with @BotFather → /newbot, and copy the token it returns. Then:
- Message the bot directly or add it to a group to scan that chat.
- For a channel, add the bot as an administrator with Post Messages and, for auto-deletion, Delete Messages.
Configuration
Copy the example and set your token. Environment variables take precedence over config.json.
Commands
| Command | Description |
|---|---|
| /scan <url> | Manually scan a URL |
| /status | Agent status + API-key health |
| /settings [key value] | View/change behavior (admins) |
| /mute / !unmute | Pause/resume this chat |
| /key <ph_...> | Set a per-team API key (admins) |
| /help | Show help |
Settings
| Setting | Default | Meaning |
|---|---|---|
| delete_malicious_messages | off | Delete confirmed malicious messages |
| warn_on_suspicious | on | Post a warning for suspicious URLs |
| post_all_results | off | Also report safe URLs |
| alert_on_error | on | Post a notice when scanning fails (e.g. bad key) |
Running the bot
Run locally:
Or run everything as containers (recommended for always-on hosting):
Verify
Message the bot /status, then /scan https://example.com — it should reply SAFE (score 0).
Troubleshooting
| Symptom | Fix |
|---|---|
| Bot can't post/delete in a channel | It must be an administrator with Post/Delete Messages rights |
| Bot starts then exits | A token is missing — check docker compose logs telegram |
| 429 responses | Rate limited — add a ph_ API key |