Prerequisites
- A Telegram account
- Access to @BotFather on Telegram
Creating a Telegram Bot
-
Start a chat with BotFather
- Open Telegram and search for
@BotFather - Send
/startto begin
- Open Telegram and search for
-
Create a new bot
- Choose a name for your bot (e.g., “My Weaver Bot”)
- Choose a username ending in
bot(e.g.,my_weaver_bot)
-
Save your bot token
- BotFather will provide a token like
123456789:ABCdefGHIjklMNOpqrsTUVwxyz - Keep this token secure - it’s your bot’s authentication
- BotFather will provide a token like
-
Optional: Configure bot settings
Configuration
Add the Telegram channel to yourconfig.yaml:
Configuration Options
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Enable Telegram channel |
token | string | Yes | Bot token from BotFather |
proxy | string | No | Proxy URL for API access |
allow_from | array | No | Allowed user IDs/usernames |
User ID Format
Telegram identifies users by numeric IDs. Theallow_from field accepts:
- Numeric user ID:
"123456789" - User ID with username:
"123456789|john_doe"
- Message your bot
- Check Weaver logs for entries like:
Supported Features
Message Types
- Text Messages - Full support with markdown/HTML formatting
- Photos - Automatically downloaded (highest resolution)
- Voice Messages - Downloaded as
.oggand transcribed if Groq is enabled - Audio Files - Downloaded as
.mp3 - Documents - Downloaded with original filename
- Captions - Extracted from media messages
Bot Commands
Weaver’s Telegram channel supports these commands:/start- Initialize bot interaction/help- Display help message/show- Show agent information/list- List available agents/features
Response Features
- Typing Indicator - Shows “typing…” while agent processes
- Thinking Animation - Displays “Thinking… 💭” placeholder
- Message Editing - Replaces placeholder with actual response
- HTML Formatting - Converts markdown to Telegram HTML
Message Formatting
Weaver automatically converts markdown to Telegram’s HTML format:| Markdown | Telegram HTML | Result |
|---|---|---|
**bold** | <b>bold</b> | bold |
_italic_ | <i>italic</i> | italic |
~~strike~~ | <s>strike</s> | |
`code` | <code>code</code> | code |
```code block``` | <pre><code>code</code></pre> | Code block |
[link](url) | <a href="url">link</a> | link |
Media Handling
The Telegram channel automatically downloads media:- Photos: Highest resolution version downloaded as
.jpg - Voice: Downloaded as
.ogg, transcribed if enabled - Audio: Downloaded as
.mp3 - Documents: Downloaded with original filename
- Temporary files: Cleaned up after processing
Voice Transcription
Enable voice transcription inconfig.yaml:
Proxy Configuration
If you need to access Telegram API through a proxy:Connection Mode
Weaver uses Long Polling to receive messages:- Connection: Direct to Telegram API
- Latency: Low (~1-2 seconds)
- No webhook setup required
- Works behind NAT/firewalls
Error Handling
Common Issues
Bot Token Invalid- Verify token with BotFather
- Ensure no extra spaces in configuration
- Add user ID to
allow_fromlist - Or remove
allow_fromto allow all users
- Message sent as plain text (non-fatal)
- Occurs with complex formatting
Security Considerations
- Token Protection: Never commit bot token to version control
- Allowlist: Use
allow_fromto restrict access - Rate Limiting: Telegram enforces API rate limits
- File Size: Telegram limits downloads to 20MB for bots
Example Configuration
Logging
Monitor Telegram channel activity:Next Steps
- Configure Agents to respond on Telegram
- Set up Voice Transcription for audio messages
- Enable Multimodal for image understanding