Why Telegram + OpenClaw?
Telegram is one of the best platforms for AI agents. Unlike WhatsApp or iMessage, Telegram has a fully open Bot API with no approval process, no message limits, and support for rich formatting, inline keyboards, and group chats. Combined with OpenClaw's multi-agent architecture, you can build anything from a personal assistant to a customer support bot serving thousands of users.
Here's what makes this combination powerful:
- Instant setup — Create a bot with BotFather, add one config block, done
- Multi-channel — The same agent can serve Telegram, Slack, Discord, and WhatsApp simultaneously
- Persistent memory — OpenClaw remembers conversation context across sessions
- Tool access — Your bot can search the web, read files, run code, and call APIs
- Group chat support — Works in both DMs and group conversations
Prerequisites
- OpenClaw installed on a VPS (one-click installer) or local machine
- A Telegram account
- 5 minutes of free time
Don't have a server yet? Check our VPS comparison guide — a $6/month Vultr instance is more than enough.
Step 1: Create a Telegram Bot with BotFather
Open Telegram and search for @BotFather. This is Telegram's official bot for creating and managing bots.
- Send
/newbotto BotFather - Choose a display name (e.g., "My AI Assistant")
- Choose a username ending in "bot" (e.g.,
my_ai_assistant_bot) - BotFather will give you an API token like:
7123456789:AAH...
/revoke in BotFather to generate a new one.
Optional but recommended — set these with BotFather:
/setdescription— What users see before starting a chat/setabouttext— Short bio shown in the bot's profile/setuserpic— Give your bot an avatar/setcommands— Add command suggestions (e.g., /help, /status)
Step 2: Configure OpenClaw
Add the Telegram channel to your OpenClaw configuration. Run:
openclaw config.patch channels.telegram.token "YOUR_BOT_TOKEN_HERE" openclaw config.patch channels.telegram.enabled true
That's the minimum config. Your bot is now connected. But let's make it smarter with a few more settings:
# Allow the bot to work in group chats (optional) openclaw config.patch channels.telegram.chatTypes '["direct","group"]' # Set which agent handles Telegram messages openclaw config.patch channels.telegram.agent "main"
Full Configuration Reference
| Setting | Description | Default |
|---|---|---|
token | Bot API token from BotFather | required |
enabled | Enable/disable the channel | false |
chatTypes | Array: "direct", "group", or both | ["direct"] |
agent | Which agent handles messages | "main" |
allowList | Array of allowed Telegram user IDs | [] (all allowed) |
Step 3: Define Your Agent's Personality
The magic of OpenClaw is in the SOUL.md file. This markdown file defines who your agent is, how it behaves, and what it knows. Here's a real example for a Telegram assistant:
# SOUL.md — Telegram AI Assistant You are Alex, a helpful AI assistant on Telegram. ## Personality - Friendly and concise — Telegram messages should be short - Use emoji sparingly but naturally 👋 - Break long responses into multiple short paragraphs - Use Telegram markdown formatting (bold, code blocks) ## Capabilities - Answer questions about our product/service - Help with technical troubleshooting - Schedule reminders and follow-ups - Search the web for current information ## Rules - Never share internal company data - Escalate billing issues to human support - Keep responses under 500 words unless asked for detail - Always respond in the user's language
Step 4: Test Your Bot
Restart OpenClaw to pick up the new config:
openclaw gateway restart
Now open Telegram, find your bot by its username, and send a message. You should get a response within a few seconds.
If something's not working, check:
openclaw gateway status— Is the gateway running?openclaw doctor— Run diagnostics- Check that your bot token is correct (no extra spaces)
- Make sure your VPS firewall allows outbound HTTPS (port 443)
Advanced: Group Chat Setup
Running your bot in Telegram groups requires a few extra steps:
Enable Group Privacy Mode
By default, Telegram bots in groups only see messages that mention them or start with a command. To let your bot see all messages:
- Open BotFather
- Send
/setprivacy - Select your bot
- Choose
Disable(this enables the bot to see all group messages)
Configure Group Behavior
You probably don't want your bot responding to every message in a group. Configure trigger patterns:
# Only respond when mentioned by name or with @ openclaw config.patch channels.telegram.groupTrigger "mention"
Options for groupTrigger:
"mention"— Only respond when @mentioned (recommended)"all"— Respond to every message (use carefully)"command"— Only respond to /commands
Real-World Use Cases
1. Customer Support Bot
Set up a Telegram bot that answers product questions 24/7. Connect it to your knowledge base and let it handle the first line of support. Escalate complex issues to human agents automatically.
2. Team Assistant in Group Chats
Add your bot to your team's Telegram group. It can summarize long threads, answer technical questions, set reminders, and pull data from connected tools like Jira or Notion.
3. Personal AI Assistant
Use OpenClaw as your personal Telegram assistant. It remembers your preferences, manages your schedule, searches the web, and even controls smart home devices through integrations.
4. Community Management
For Telegram communities, your bot can welcome new members, answer FAQs, moderate content, and provide automated onboarding flows.
5. Sales & Lead Qualification
Build a sales agent that qualifies leads through Telegram conversations. It can ask qualifying questions, share product info, and hand off hot leads to your sales team.
Telegram vs Other Channels
| Feature | Telegram | Slack | Discord | |
|---|---|---|---|---|
| Bot API | ✅ Free, open | ⚠️ Paid, approval needed | ✅ Free | ✅ Free |
| Group chats | ✅ Up to 200K members | ✅ Up to 1024 | ✅ Channels | ✅ Channels |
| Rich formatting | ✅ Markdown + HTML | ⚠️ Limited | ✅ Blocks | ✅ Embeds |
| File sharing | ✅ Up to 2GB | ✅ Up to 100MB | ✅ Varies | ✅ Up to 25MB |
| Setup time | 5 min | Days-weeks | 10 min | 10 min |
| Best for | Personal, communities | Business, customers | Teams | Communities |
Want to connect multiple channels? OpenClaw supports all of them simultaneously. Check our integration guides for Slack, Discord, and WhatsApp.
Troubleshooting
Bot doesn't respond
- Check
openclaw gateway status— gateway must be running - Verify the bot token with
curl https://api.telegram.org/bot<TOKEN>/getMe - Check firewall: outbound HTTPS (443) must be open
- Look at gateway logs for error messages
Bot responds slowly
- Check your AI API latency — try a faster model or provider
- Ensure your VPS has enough RAM (2GB minimum recommended)
- Consider using a VPS closer to your users geographically
Bot doesn't work in groups
- Verify
chatTypesincludes "group" in your config - Check BotFather privacy settings (disable privacy mode)
- Make sure the bot has been added to the group as a member
Frequently Asked Questions
Can OpenClaw handle Telegram group chats?
Yes. Set chatTypes to include "group" in your config. The agent responds when mentioned by name or when messages match trigger patterns you define.
Does OpenClaw support Telegram inline keyboards and buttons?
OpenClaw supports sending messages with Telegram's native formatting. For interactive buttons and inline keyboards, you can use the message tool with Telegram-specific parameters.
How many Telegram conversations can OpenClaw handle simultaneously?
There's no hard limit. Each conversation runs in its own session. A typical VPS with 2GB RAM can handle hundreds of concurrent Telegram conversations.
Can I use OpenClaw with multiple Telegram bots?
Yes. You can configure multiple agents in OpenClaw, each with its own Telegram bot token and personality. They run independently on the same server.
Is the Telegram integration free?
The Telegram Bot API is free. OpenClaw is open source and free. You only pay for the VPS ($5-12/month) and AI API costs (varies by usage).
Next Steps
Your Telegram bot is running. Here's what to do next:
- Add more channels — Connect Slack or Discord to reach your team everywhere
- Customize the personality — Fine-tune your SOUL.md based on real conversations
- Add tools — Give your agent access to web search, file reading, and API calls
- Set up monitoring — Review conversations and improve responses over time
- Scale up — Need more power? Check our VPS comparison for upgrade options
🔥 Ready to Build Your AI Agent?
Get 100 ready-to-use SOUL.md templates for any industry — only $9.90
Get SOUL.md Mega Pack →Or start free: Download 5 Free Templates