Telegram Integration
Deploy OpenClaw as Your Personal Telegram Bot
Leverage Telegram's powerful Bot API to create a feature-rich AI assistant. With native bot support, inline queries, custom keyboards, file processing up to 2GB, and unlimited message history, Telegram provides the perfect platform for advanced OpenClaw interactions. No workarounds needed - just official API integration.
Setup Guide
Create Your Bot with BotFather
Start a chat with @BotFather on Telegram and use the /newbot command to create your OpenClaw bot. Choose a display name and username (must end in 'bot'). BotFather will provide an API token - keep this secure as it grants full control over your bot.
# In Telegram, message @BotFather:
/newbot
# Follow the prompts:
# 1. Enter display name: OpenClaw Assistant
# 2. Enter username: YourName_OpenClaw_bot
# You'll receive a token like:
# 1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
# Save this token securely!
# Additional BotFather commands:
/setdescription - Set bot description
/setabouttext - Set 'About' text
/setuserpic - Set profile picture
/setcommands - Define command menu Install Telegram Bridge Module
Add the Telegram bridge to your OpenClaw installation. The bridge handles all communication with Telegram's Bot API, including message parsing, media handling, and response formatting. It supports both webhook and long-polling modes.
# Using OpenClaw CLI
openclaw install telegram-bridge
# Or manual installation
cd /path/to/openclaw
npm install @openclaw/telegram-bridge
# Verify installation
openclaw plugins list | grep telegram Configure Bot Connection
Create your Telegram configuration file with the bot token and connection settings. Choose between webhook mode (recommended for production) or long-polling mode (easier for development). Configure how the bot handles different message types.
# config/telegram.yaml
telegram:
enabled: true
bot_token: "YOUR_BOT_TOKEN_HERE" # From BotFather
# Connection mode
mode: webhook # or 'polling' for development
webhook:
url: "https://yourdomain.com/telegram/webhook"
port: 8443
certificate: "/path/to/cert.pem" # For self-signed
# Polling settings (if using polling mode)
polling:
interval: 1000 # milliseconds
timeout: 30
# Bot settings
settings:
parse_mode: "HTML" # or 'Markdown', 'MarkdownV2'
disable_web_page_preview: false
protect_content: false Define Commands and Handlers
Set up bot commands that appear in Telegram's command menu, and configure handlers for different interaction types. Define how OpenClaw responds to text, media, inline queries, and callback buttons.
# config/telegram-commands.yaml
commands:
# Registered commands (appear in menu)
- command: start
description: Start the bot and see welcome message
- command: help
description: Show available commands
- command: settings
description: Configure your preferences
- command: tasks
description: View and manage your tasks
- command: calendar
description: Check your schedule
- command: weather
description: Get weather forecast
- command: home
description: Control smart home devices
handlers:
text:
enabled: true
ai_response: true
voice:
enabled: true
transcribe: true
respond_with: text # or 'voice'
photo:
enabled: true
analyze: true
max_size_mb: 20
document:
enabled: true
allowed_types: ["pdf", "docx", "xlsx", "txt", "json"]
max_size_mb: 50
inline_query:
enabled: true
cache_time: 300 # seconds
results_limit: 50 Configure Inline Query Responses
Set up inline mode to allow using OpenClaw from any chat. Users can type @YourBot followed by a query to get AI responses without opening a direct conversation. Configure result types and caching behavior.
# config/telegram-inline.yaml
inline:
enabled: true
placeholder: "Ask me anything..."
# Result types to generate
result_types:
- article # Text responses
- photo # Image results
- document # File results
# Quick responses for common queries
quick_responses:
weather:
trigger: "weather"
handler: weather_inline
translate:
trigger: "translate"
handler: translation_inline
calculate:
trigger: "calc"
handler: calculator_inline
# Caching
cache:
enabled: true
personal_results: true # Different results per user
ttl: 300 # seconds Set Up Custom Keyboards
Create interactive button interfaces for common actions. Reply keyboards appear below the input field, while inline keyboards attach to messages. Use callback queries to handle button presses.
# config/telegram-keyboards.yaml
keyboards:
main_menu:
type: inline
buttons:
- - { text: "Tasks", callback: "menu:tasks" }
- { text: "Calendar", callback: "menu:calendar" }
- - { text: "Smart Home", callback: "menu:home" }
- { text: "Weather", callback: "menu:weather" }
- - { text: "Settings", callback: "menu:settings" }
smart_home:
type: inline
buttons:
- - { text: "Lights On", callback: "home:lights:on" }
- { text: "Lights Off", callback: "home:lights:off" }
- - { text: "Thermostat", callback: "home:thermostat" }
- - { text: "Back to Menu", callback: "menu:main" }
quick_reply:
type: reply
resize: true
one_time: true
buttons:
- - "Yes"
- "No"
- - "Cancel" Configure Group Behavior
Set up how OpenClaw behaves in group chats. Configure privacy mode, mention requirements, and admin capabilities. Define moderation features if you want the bot to help manage groups.
# config/telegram-groups.yaml
groups:
privacy_mode: true # Only receive messages when mentioned
require_mention: true
mention_triggers:
- "@YourBot"
- "/ai"
- "!ai"
# Admin features (if bot is group admin)
admin:
welcome_new_members: true
welcome_message: "Welcome {name} to the group!"
anti_spam: true
content_filter: false
handle_join_requests: false
# Per-group settings
group_overrides:
"group_chat_id_here":
ai_enabled: true
require_mention: false # Respond to all messages
allowed_commands: ["help", "weather"] Test and Deploy
Test your bot configuration locally before deploying to production. Verify all handlers work correctly, test inline queries, and ensure media processing functions as expected.
# Start bot in development mode
openclaw telegram start --dev
# Test specific features
openclaw telegram test --feature inline
openclaw telegram test --feature media
openclaw telegram test --feature callbacks
# Check webhook status (if using webhooks)
openclaw telegram webhook status
# View real-time logs
openclaw logs telegram --follow
# Deploy to production
openclaw telegram start --production
# Register commands with Telegram
openclaw telegram commands sync What You Can Do
Personal AI Assistant
Your always-available personal assistant that understands context from your conversation history. Ask questions, get recommendations, manage tasks, and have intelligent conversations that remember your preferences and past interactions. The unlimited message history means your AI truly knows you over time.
Document Processing Hub
Send any document to your bot for intelligent processing. PDFs are summarized, spreadsheets analyzed, images described, and code files reviewed. With support for files up to 2GB, handle large documents that other platforms reject. Extract data, convert formats, and get AI insights from any file type.
Group Knowledge Bot
Deploy OpenClaw in team or community groups to provide instant answers, moderate discussions, and assist all members. The bot can answer FAQs, search through shared knowledge, translate messages in real-time, and help coordinate group activities.
Inline Quick Actions
Use @YourBot in any chat for instant AI assistance without switching conversations. Quick translations while chatting with international friends, fact-checking during debates, unit conversions, or generating responses - all inline without opening the bot chat.
Smart Home Dashboard
Control your entire smart home through custom Telegram keyboards. Create visual dashboards with buttons for every device, scene, and automation. Get notifications about home events, view camera snapshots, and manage security - all from your Telegram app.
Media Analysis and Creation
Send photos for AI analysis, description, or modification suggestions. Get detailed descriptions of images, extract text via OCR, identify objects and people, analyze charts and graphs, or get artistic feedback on your photography.
Voice Message Processing
Send voice messages and get intelligent responses. OpenClaw transcribes your audio, understands the request, and can respond with text or synthesized voice. Perfect for hands-free operation while driving, exercising, or when typing isn't convenient.
Scheduled Reminders and Updates
Set up scheduled messages for daily briefings, reminder notifications, habit tracking prompts, and regular updates. The bot can send weather forecasts every morning, remind you of medications, or deliver daily motivation at your preferred time.
Learning and Flashcards
Create an interactive learning companion. Generate flashcards for any subject, get quizzed on material, practice language learning with conversation, and track your progress. The bot adapts to your learning pace and focuses on areas where you need more practice.
Known Limitations
- Bot API has rate limits: 30 messages per second to different chats, 1 message per second to the same chat
- Webhook mode requires a publicly accessible HTTPS URL with valid SSL certificate
- Bots cannot initiate conversations - users must start the chat first or be group members
- In group privacy mode, bots only receive messages that mention them or commands directed at them
- File downloads are limited to 20MB through the Bot API (uploads up to 2GB work fine)
- Bots cannot see messages sent before they were added to a group
- Inline mode results are cached - rapid changes may not reflect immediately
- Media group messages (albums) arrive as separate messages, requiring special handling
- Bot usernames must end in 'bot' and be unique across all of Telegram
- Some advanced features like video calls and stories are not available to bots
- Our team can help you work around these limitations with custom configurations
Related Content
Bring OpenClaw AI Power to Your Discord Server
Deploy OpenClaw as a Discord bot for your server. Automate moderation, answer questions, manage communities, run games, and provide AI assistance to all your members with slash commands and rich embeds.
Supercharge Your Gmail with OpenClaw AI
Connect OpenClaw to Gmail for intelligent email management. Automatically summarize messages, draft responses, organize your inbox, and manage emails through natural language commands.
Connect OpenClaw to LINE Messenger
Deploy OpenClaw on LINE messenger to reach 200 million users across Japan, Taiwan, Thailand, and Indonesia. Build powerful AI chatbots with rich messaging, LIFF apps, and LINE ecosystem integration.
OpenClaw on Matrix: Decentralized AI for a Decentralized World
Deploy OpenClaw on the Matrix protocol for a truly decentralized AI assistant. Self-host everything, federate with others, and maintain complete sovereignty over your AI interactions.