Why Telegram?
- Simple Setup: Just a bot token, no complicated configuration
- No Webhooks: Uses long polling, works behind NAT/firewall
- Rich Features: Supports text, voice messages, files, and media
- Group Chat: Works in private chats and group conversations
- Voice Transcription: Automatic transcription when Groq is configured
Prerequisites
- A Telegram account
- PicoClaw installed and configured with an LLM provider
- 2 minutes of your time
Setup Instructions
Create a Bot
Open Telegram and search for
@BotFather:- Start a chat with @BotFather
- Send the command
/newbot - Follow the prompts to choose a name and username for your bot
- Copy the bot token (format:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz)
Keep your bot token secure! Anyone with this token can control your bot.
Get Your User ID
To restrict bot access to yourself:
- Search for
@userinfobotin Telegram - Start a chat and send any message
- Copy your user ID (a numeric value like
123456789)
Configure PicoClaw
Edit Replace:
~/.picoclaw/config.json and add the Telegram configuration:token: Your bot token from @BotFatherallow_from: Your user ID from @userinfobot (or empty array[]for public access)
Start the Gateway
Run the Gateway server:You should see a log message confirming Telegram connection:
Configuration Options
Basic Configuration
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Set to true to enable Telegram channel |
token | string | Yes | Bot token from @BotFather |
allow_from | array | No | List of allowed user IDs (empty array = allow all) |
Access Control
Allow specific users only:Features
Text Messages
Send any text message to your bot and receive AI-generated responses. The bot maintains conversation context within the session.Voice Messages
If you have Groq configured with a Whisper API key, Telegram voice messages are automatically transcribed and processed:Group Chats
Telegram bots work in group chats. By default:- The bot responds to all messages in groups where it’s added
- You can mention the bot with
@yourbotnameto direct messages to it
For privacy, bots need “Privacy Mode” disabled in @BotFather settings to read all group messages. Otherwise, they only see commands and @mentions.
File Handling
Send files, images, and documents to your bot for analysis or processing (requires compatible LLM with vision capabilities).Troubleshooting
”Conflict: terminated by other getUpdates”
Cause: Another instance of the bot is already running, or you’re using the same token elsewhere. Solution:- Stop all other
picoclaw gatewayprocesses - Make sure no other applications are using your bot token
- Restart the gateway with
picoclaw gateway
Bot doesn’t respond
Check these common issues:- Gateway not running: Make sure
picoclaw gatewayis running - Wrong user ID: Verify your user ID in
allow_frommatches your Telegram ID - LLM not configured: Ensure you have a valid LLM provider configured
- Token invalid: Regenerate token with @BotFather if needed
Check logs for errors
Bot receives but doesn’t reply
Possible causes:- LLM provider API key is invalid or expired
- LLM provider rate limits exceeded
- Network connectivity issues
- Test your LLM configuration with
picoclaw agent -m "test" - Review your API key in
config.json - Check your provider’s dashboard for errors
Advanced Configuration
Using with Docker
If running PicoClaw in Docker, the Gateway is accessible inside the container:Multiple User IDs
To allow multiple users:Environment Variables
You can override configuration with environment variables:Privacy & Security
Best Practices
- Personal Use: Always set
allow_fromwith your user ID - Team Use: List all team member IDs in
allow_from - Token Rotation: Regenerate tokens periodically via @BotFather
- Log Management: Rotate and secure log files containing conversations
- LLM Costs: Monitor API usage to avoid unexpected bills
Complete Example
Here’s a completeconfig.json snippet for Telegram:
Next Steps
Discord Channel
Set up Discord integration
WhatsApp Channel
Connect via WhatsApp
Configuration
Learn about other configuration options
Troubleshooting
Common issues and solutions