The Telegram channel allows your Corvus agent to interact with users via Telegram bots using the Telegram Bot API.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dallay/corvus/llms.txt
Use this file to discover all available pages before exploring further.
Features
- Long-polling for real-time message delivery
- Typing indicators during processing
- Progressive message updates (streaming mode)
- Username and user ID allowlist
- Pairing code for self-service binding
- Media attachment support
- Forum/topic support
- Message splitting for long responses (4096 char limit)
Bot Setup with BotFather
1. Create Your Bot
- Open Telegram and search for
@BotFather - Send
/newbotcommand - Follow the prompts:
- Enter a name for your bot (e.g., “Corvus Assistant”)
- Enter a username ending in
bot(e.g., “corvus_ai_bot”)
- BotFather will respond with your bot token:
2. Configure Bot Settings
Optional but recommended:- Privacy Mode: Send
/setprivacyto BotFather, select your bot, and chooseDisable(allows bot to see all messages in groups) - About Text: Send
/setabouttextto set a description - Profile Picture: Send
/setuserpicto upload an avatar
3. Get Your Telegram User ID
You need your user ID for the allowlist:- Search for
@userinfobotin Telegram - Send any message - it will reply with your user ID
- Note the numeric ID (e.g.,
123456789)
Configuration
Add Telegram configuration to~/.corvus/config.toml:
Configuration Options
| Field | Type | Required | Description |
|---|---|---|---|
bot_token | String | Yes | Bot token from BotFather |
allowed_users | Array | Yes | List of allowed usernames or user IDs |
stream_mode | String | No | Streaming mode: "off" or "full" (default: "off") |
draft_update_interval_ms | Integer | No | Throttle interval for draft edits in ms (default: 1000) |
Streaming Mode
"off"- Send complete response as a single message"full"- Send draft message and progressively update as the LLM generates text
Allowlist Patterns
Username Format
Usernames are normalized by removing the leading@ symbol:
Numeric User ID
More secure than usernames (users can change usernames):Mixed Allowlist
You can combine usernames and user IDs:Wildcard (Allow All)
Not recommended for production:Pairing Flow
Ifallowed_users is empty, Corvus automatically enables pairing mode.
Operator-Side Setup
-
Start Corvus with empty allowlist:
-
Corvus outputs a one-time pairing code:
User-Side Binding
-
User sends to the bot:
-
Bot responds:
-
User’s identity is added to
allowed_usersin config and persisted.
Manual Binding
Operator can bind users manually from CLI:Testing and Verification
1. Start Channel Listener
2. Health Check
Verify bot authentication:3. Send Test Message
- Open Telegram and search for your bot username
- Send
/startor any message - If you’re in the allowlist, the bot should respond via the LLM
- If not allowlisted, you’ll see:
Advanced Features
Forum/Topic Support
Telegram forums (topics) are automatically supported. Thereply_target format is:
Media Attachments
The agent can send media by including markers in responses:[IMAGE:<path-or-url>]- Send as photo[DOCUMENT:<path-or-url>]- Send as document[VIDEO:<path-or-url>]- Send as video[AUDIO:<path-or-url>]- Send as audio[VOICE:<path-or-url>]- Send as voice message
sendPhoto, sendDocument, etc.
Message Splitting
Telegram has a 4096 character limit. Long messages are automatically split at word boundaries:Markdown Formatting
Telegram supports Markdown in messages. The agent can use:*bold*- bold text_italic_- italic text[link](url)- hyperlinks`code`- inline code-
code blocks
Troubleshooting
Bot Not Responding
-
Check allowlist:
-
Verify user is allowlisted:
-
Check logs for authorization warnings:
409 Conflict Error
corvus instance is running:
Invalid Bot Token
- Send
/tokento@BotFather - Select your bot
- Copy the token and update
config.toml
Rate Limiting
Telegram enforces rate limits:- 30 messages per second to different users
- 1 message per second to the same user
- 20 edit operations per minute
draft_update_interval_ms.
Security Best Practices
- Use User IDs: Prefer numeric user IDs over usernames (usernames can be changed)
- Never Share Token: Keep
bot_tokensecret - it grants full bot access - Empty Allowlist by Default: Start with
allowed_users = []and explicitly add users - Monitor Logs: Watch for unauthorized access attempts
- Rotate Tokens: Regenerate token via BotFather if compromised
Reference
- Source:
clients/agent-runtime/src/channels/telegram.rs - Telegram Bot API: https://core.telegram.org/bots/api
- BotFather: https://t.me/BotFather
- Line range:
telegram.rs:1-1628