Telegram AI Assistant: Complete Guide with OpenClaw
Build a powerful Telegram AI assistant that works for you around the clock
Telegram's Bot API is one of the most developer-friendly platforms for building AI assistants. With over 900 million monthly active users, Telegram offers an enormous audience for your AI-powered bot β whether for personal productivity, customer support, or community management.
OpenClaw makes it easy to create a self-hosted Telegram AI assistant that connects to any AI provider. Your bot runs on your infrastructure, ensuring message privacy and giving you complete control over the AI behavior, costs, and data.
What You'll Build
- A Telegram bot with natural language understanding and multi-turn conversations
- Support for both private chats and group conversations
- Inline mode for AI-powered responses in any chat
- Self-hosted with full privacy β no third-party data processing
Setup Guide
Step 1: Install OpenClaw
Deploy OpenClaw using Docker:
docker pull openclaw/openclaw:latest
docker run -d --name openclaw -p 8080:8080 openclaw/openclaw:latestFor other methods, check the Quick Start Guide.
Step 2: Create a Telegram Bot
Creating a Telegram bot takes less than 2 minutes:
- Open Telegram and search for @BotFather
- Send
/newbotand follow the prompts - Choose a display name and username ending in "bot"
- BotFather will give you a Bot Token β save it securely
- Send
/setcommandsto register bot commands:ask - Ask the AI a question summarize - Summarize text or article translate - Translate text help - Show available commands
Step 3: Configure OpenClaw Channel
Add the Telegram channel to openclaw.json:
{
"channels": [
{
"type": "telegram",
"name": "my-telegram-bot",
"token": "123456:ABC-DEF_your_bot_token",
"allowed_updates": ["message", "callback_query"],
"default_skill": "chat",
"group_mode": "mention_only"
}
]
}The group_mode: "mention_only" setting means the bot only responds when mentioned in groups, avoiding noise.
Step 4: Set Up Webhook (Recommended)
For production, use webhooks instead of polling:
curl -X POST "https://api.telegram.org/bot{YOUR_TOKEN}/setWebhook" \
-H "Content-Type: application/json" \
-d '{"url": "https://your-server.com/api/telegram/webhook"}'Webhooks are recommended for production as they reduce latency, lower server resource usage, and scale better.
Step 5: Configure AI Skills
Set up skills tailored for Telegram's mobile-first experience:
{
"skills": {
"chat": {
"provider": "openai",
"model": "gpt-4",
"system_prompt": "You are a helpful assistant on Telegram. Keep responses concise (under 200 words).",
"max_tokens": 500
},
"translate": {
"provider": "anthropic",
"model": "claude-3-haiku",
"system_prompt": "Translate the following text. Detect the source language automatically."
}
}
}Step 6: Test and Go Live
Restart OpenClaw and start chatting:
docker restart openclaw- Open Telegram and find your bot by username
- Send
/startto initialize the conversation - Try asking a question
- Test commands:
/summarize [paste article URL] - Add the bot to a group and test mention responses
For high-availability deployment, see our Deployment Guide.
Use Cases
Personal AI Assistant
Your private AI companion on Telegram β ask questions, get translations, summarize articles, and brainstorm ideas on the go.
Customer Support Bot
Handle customer inquiries automatically with AI-powered responses. Support multiple languages for a global customer base.
Group Study Helper
Add the bot to study groups to explain concepts, quiz members, and summarize learning materials.
News & Content Digest
Send articles or links to the bot and get AI-generated summaries, key takeaways, and analysis.
Quick Configuration
{
"gateway": { "mode": "local" },
"ai": { "provider": "openai", "model": "gpt-4" },
"channels": [
{
"type": "telegram",
"name": "my-bot",
"token": "123456:ABC-DEF",
"group_mode": "mention_only"
}
]
}Frequently Asked Questions
Is there a message limit for Telegram bots?
Telegram allows bots to send up to 30 messages per second overall, and 1 message per second per chat. OpenClaw handles rate limiting automatically.
Can the bot handle images and files?
Currently, OpenClaw processes text messages from Telegram. Image analysis via multimodal AI models and file processing support are planned for upcoming releases.
How do I handle multiple languages?
OpenClaw can detect the user's language from their message and respond in the same language. Configure your AI skill's system prompt accordingly.
Can I run the bot on a Raspberry Pi?
Yes! OpenClaw is lightweight enough to run on a Raspberry Pi 4 (4GB RAM). Pair it with a local model via Ollama for a completely self-contained, private AI assistant.
Ready to Build Your AI Bot?
Get OpenClaw running in minutes and connect to your favorite platform.
Get Started with OpenClaw