How to Create a Telegram AI Bot with OpenClaw (Step-by-Step Guide 2026)
Complete guide to building your own Telegram AI bot with OpenClaw. Step-by-step setup, configuration tips, use cases, and a 60-second alternative.
Which model do you want as default?
Which channel do you want to use?
Limited servers, only 13 left
Telegram has over 1 billion monthly active users, and its Bot API is one of the most powerful on any messaging platform. Combine that with OpenClaw, the open-source AI assistant which is one of the most popular open-source AI projects, and you get a personal AI agent living right inside your favorite messaging app.
But setting it all up from scratch? That involves servers, Docker, API keys, configuration files, and ongoing maintenance. This guide walks you through every step of creating a Telegram AI bot with OpenClaw, from zero to a working assistant. We also cover configuration tips, real-world use cases, and a faster alternative if you'd rather skip the DevOps entirely.
What You Need Before Starting
Before diving into setup, make sure you have these prerequisites ready:
Hardware and Software:
- A server or VPS (check official docs for current requirements) (Hetzner, DigitalOcean, or any Linux VPS)
- Docker and Docker Compose installed
- A terminal with SSH access to your server
- Node.js 22+ (if running OpenClaw without Docker)
Accounts and Tokens:
- A Telegram account (phone number required)
- An AI model API key (OpenAI, Anthropic, Google, or any OpenAI-compatible provider)
- A GitHub account (optional, for cloning the repo)
Time Estimate:
- Technical setup: 30-60 minutes
- Configuration and testing: 30 minutes
- Total: about 1-2 hours for a developer
If that sounds like a lot, skip ahead to the 60-second alternative section.
Step 1: Create Your Telegram Bot with BotFather
Every Telegram bot starts with @BotFather, Telegram's official bot creation tool.
- Open Telegram and search for
@BotFather(look for the blue checkmark) - Send
/startto see available commands - Send
/newbotand follow the prompts:- Choose a display name (e.g., "My AI Assistant")
- Choose a username ending in
bot(e.g.,myai_assistant_bot)
- Save your bot token immediately. It looks like:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz
Important BotFather settings to configure:
/setprivacy- Set to OFF so your bot can read all group messages (required for OpenClaw group support)/setjoingroups- Set to Allow if you want the bot in group chats/setdescription- Add a description so users know what your bot does/setabouttext- Brief info visible on the bot's profile
Keep your bot token secure. Anyone with this token can control your bot. If it gets compromised, use /revoke in BotFather to generate a new one.
Step 2: Set Up Your Server
You need a server running 24/7 for your bot to stay online. Here are the most common options:
Option A: Docker (Recommended)
# SSH into your server
ssh user@your-server-ip
# Create a directory for OpenClaw
mkdir openclaw && cd openclaw
# Create docker-compose.yml
# Download and run the official Docker setup script
curl -fsSL https://raw.githubusercontent.com/openclaw/openclaw/main/docker-setup.sh | bash
Option B: Manual Installation
# Clone the repository
git clone https://github.com/openclaw/openclaw.git
cd openclaw
# Install dependencies
npm install -g openclaw
# Start the gateway
openclaw gateway start
Verify It's Running
# Check Docker logs
docker logs openclaw --follow
# Or if running manually
openclaw logs --follow
You should see the gateway starting up and connecting to Telegram. If you see 401 Unauthorized, double-check your bot token.
Step 3: Configure the Telegram Channel
OpenClaw uses a JSON configuration file to manage channels. Here's the essential Telegram setup:
{
"channels": {
"telegram": {
"enabled": true,
"token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
"dmPolicy": "pairing",
"allowFrom": ["your_telegram_user_id"]
}
}
}
Understanding DM Policies
OpenClaw offers several access control modes:
| Policy | Behavior | Best For |
|---|---|---|
pairing | Users must enter a pairing code to activate | Personal use, secure access |
allowlist | Only specified user IDs can interact | Business teams, restricted access |
open | Anyone can message the bot | Public bots, customer service |
disabled | DMs are turned off | Group-only bots |
Finding Your Telegram User ID
The easiest way:
- Send a message to your bot
- Check the OpenClaw logs:
openclaw logs --follow - Look for
from.idin the incoming message
Or use the Bot API directly:
curl "https://api.telegram.org/bot<your_token>/getUpdates"
Step 4: Connect Your AI Model
OpenClaw supports virtually any AI model. Configure your preferred provider:
OpenAI (GPT-4o, GPT-4.1)
{
"models": {
"default": "openai/gpt-4o",
"providers": {
"openai": {
"apiKey": "sk-your-openai-key"
}
}
}
}
Anthropic (Claude)
{
"models": {
"default": "anthropic/claude-sonnet-4-20250514",
"providers": {
"anthropic": {
"apiKey": "sk-ant-your-key"
}
}
}
}
Google (Gemini)
{
"models": {
"default": "google/gemini-2.5-pro",
"providers": {
"google": {
"apiKey": "your-google-key"
}
}
}
}
You can also use local models via Ollama or any OpenAI-compatible API endpoint.
Step 5: Test Your Bot
With everything configured, it's time to test:
- Open Telegram and find your bot by its username
- Send
/startto initiate the conversation - If you're using
pairingmode, enter the pairing code shown in your server logs - Send a message like "Hello, what can you do?"
- Your AI assistant should respond within a few seconds
Quick Health Check
Run these commands to verify everything is working:
# Check gateway status
openclaw gateway status
# Watch real-time logs
openclaw logs --follow
# Check gateway status
openclaw gateway status
If something looks off, check the logs with openclaw logs --follow and verify your configuration in ~/.openclaw/openclaw.json.
Step 6: Configure Group Chat Support
One of OpenClaw's strongest features is group chat integration. Your bot can participate in team conversations, answer questions, and run automations for everyone in the group.
Enable Group Access
{
"channels": {
"telegram": {
"groups": {
"*": {
"groupPolicy": "open",
"requireMention": true
}
}
}
}
}
Key Settings
requireMention: Whentrue, the bot only responds when mentioned with@botusername. Set tofalsefor the bot to respond to every message.groupPolicy: Controls who can interact in groups.openallows everyone,allowlistrestricts to specific users.- Forum topics: OpenClaw automatically isolates conversations by topic in Telegram forum groups.
Getting the Group Chat ID
To restrict access to specific groups:
- Add your bot to the group
- Forward a group message to
@userinfobot - Or check
chat.idin the OpenClaw logs
Advanced Configuration Tips
Custom System Prompt (Personality)
Give your bot a unique personality by setting a system prompt:
{
"agents": {
"defaults": {
"systemPrompt": "You are a helpful business assistant for Acme Corp. You specialize in customer support, scheduling, and product information. Always be professional but friendly."
}
}
}
Enable Skills and Tools
OpenClaw skills extend your bot's capabilities far beyond simple chat:
- Web browsing: Search the internet and summarize results
- Calendar management: Check schedules and create events
- Email: Read and compose emails
- File handling: Process documents, images, and spreadsheets
- Custom skills: Build your own integrations
Rate Limiting and Security
For production deployments:
{
"agents": {
"defaults": {
"maxConcurrent": 3
}
},
"channels": {
"telegram": {
"dmPolicy": "allowlist",
"allowFrom": ["user_id_1", "user_id_2"]
}
}
}
Multi-Account Setup
Run multiple bots from a single OpenClaw instance:
{
"channels": {
"telegram": {
"accounts": {
"default": {
"token": "token_for_main_bot",
"allowFrom": ["admin_id"]
},
"support": {
"token": "token_for_support_bot",
"allowFrom": ["*"]
}
}
}
}
}

Real-World Use Cases
For Business Owners
- Customer support bot: Answer FAQs 24/7, handle common requests, escalate complex issues to humans
- Appointment scheduling: Let clients book directly through Telegram
- Order tracking: Connect to your e-commerce platform and give customers real-time updates
- Lead qualification: Ask prospects qualifying questions and route hot leads to your sales team
For Solopreneurs and Freelancers
- Personal assistant: Manage your calendar, draft emails, and organize tasks from your phone
- Client communication: Provide a professional AI-powered support channel without hiring staff
- Content creation: Brainstorm ideas, draft social media posts, and research topics on the go
- Invoice reminders: Automate follow-ups with clients who haven't paid
For Teams and Communities
- Team knowledge base: Your bot remembers past conversations and can recall information for anyone in the group
- Meeting summaries: Get AI-generated summaries of group discussions
- Onboarding assistant: Help new team members find information and get up to speed
- Moderation helper: Flag inappropriate content or answer repetitive questions automatically
For Developers
- Code review assistant: Paste code snippets and get instant feedback
- Documentation bot: Query your project docs directly in Telegram
- Deployment notifications: Get alerts about CI/CD pipelines, server health, and errors
- API testing: Quickly test API endpoints and parse responses through natural language
The True Cost of Self-Hosting
Before you commit to the DIY route, here's what the monthly bill actually looks like:
| Item | Cost |
|---|---|
| VPS | $5-12/month |
| AI model API costs | $5-50/month (depends on usage) |
| Domain + SSL (optional) | $1-2/month |
| Your time for maintenance | 2-5 hours/month |
| Total | $11-64/month + your time |
The hidden cost is your time. Server updates, Docker maintenance, debugging connection issues at 2 AM when a customer needs help, keeping up with OpenClaw releases, monitoring uptime. For a developer, this might be fun. For a business owner, every hour spent on DevOps is an hour not spent on revenue.
Deploy in 60 Seconds with ClawRapid
What if you could skip all of the above and have a working Telegram AI bot in under a minute?
ClawRapid is a fully managed OpenClaw hosting service built for non-technical users. Here's how it works:
- Pick your AI model (GPT-4o, Claude, Gemini, and more)
- Connect your Telegram (paste your bot token)
- Click Deploy
That's it. No server, no Docker, no SSH, no configuration files. Your bot is live in about 60 seconds.
What you get with ClawRapid:
- Managed hosting with 99.9% uptime
- Automatic OpenClaw updates
- Pre-configured security (no exposed API keys)
- Human support when you need help
- All channels supported: Telegram, WhatsApp, Discord, and more
- Custom AI personality per business niche
Pricing: $45 per month, flat. No surprise API bills, no server costs, no maintenance overhead.
For business owners, coaches, real estate agents, and freelancers who need a Telegram AI bot without the technical hassle, ClawRapid is the fastest path from idea to working assistant.
Troubleshooting Common Issues
Bot Not Responding
- Check that your bot token is correct in
~/.openclaw/openclaw.json - Verify the gateway is running:
openclaw gateway status - Ensure your Telegram user ID is in the
allowFromlist - Check if
dmPolicyis set todisabled(switch topairingoropen)
401 Unauthorized Error
Your bot token is invalid. Go to BotFather, use /revoke, and generate a new token. Update your configuration and restart OpenClaw.
Bot Doesn't Respond in Groups
- Check that
/setprivacyis set to OFF in BotFather - Verify
groupPolicyis not set todisabled - If
requireMentionistrue, make sure you're tagging the bot with@botusername
Slow Responses
- Check your AI model provider's status page
- Reduce
maxConcurrentif running on a small VPS - Consider switching to a faster model (e.g., GPT-4o-mini for quick responses)
Connection Drops
OpenClaw uses long polling by default, which is resilient to most network issues. If you experience frequent drops:
- Check your server's internet stability
- Ensure Docker has enough memory allocated
- Review logs for timeout errors:
openclaw logs --follow
FAQ
Q: Is OpenClaw free? A: Yes, OpenClaw is completely open-source and free. However, you need to pay for hosting (a VPS) and AI model API calls separately. ClawRapid bundles everything for $45 per month.
Q: Which AI model works best with Telegram? A: For general use, GPT-4o offers the best balance of speed and quality. For complex reasoning, Claude Sonnet 4 is excellent. For budget-conscious users, GPT-4o-mini or Gemini Flash are fast and affordable.
Q: Can my bot handle multiple users at once?
A: Yes. OpenClaw isolates sessions per user and per group, so conversations never mix. The maxConcurrent setting controls how many requests are processed simultaneously.
Q: Does the bot work in Telegram groups? A: Absolutely. OpenClaw has full group support with configurable mention requirements, per-group policies, and forum topic isolation. See the group chat section above.
Q: Can I switch AI models later? A: Yes. You can change the model at any time by updating your configuration. OpenClaw supports hot-reloading, so you don't need to restart the gateway.
Q: Is my data private? A: When self-hosting, all data stays on your server. With ClawRapid, your data is stored on dedicated European servers with encryption at rest. No data is shared with third parties.
Q: Can I use the bot for my business? A: Yes. Many businesses use OpenClaw Telegram bots for customer support, lead generation, appointment booking, and internal team assistance. For business use, we recommend either a robust self-hosted setup or ClawRapid for zero-maintenance operation.
Q: What happens if my server goes down? A: Your bot goes offline until the server is back. Messages sent during downtime are not lost by Telegram, but your bot won't process them until it reconnects. ClawRapid includes automatic failover and 99.9% uptime guarantees.
Wrapping Up
Building a Telegram AI bot with OpenClaw gives you a powerful, customizable assistant that lives right where you already spend your time. Whether you're automating customer support for your business or creating a personal AI companion, the combination of Telegram's reach and OpenClaw's capabilities is hard to beat.
The self-hosted route gives you full control but demands technical skills and ongoing maintenance. If that's your thing, this guide has everything you need to get started.
If you'd rather focus on your business instead of managing servers, ClawRapid gets you the same result in 60 seconds, fully managed, with human support included.
Which model do you want as default?
Which channel do you want to use?
Limited servers, only 6 left
Which model do you want as default?
Which channel do you want to use?
Limited servers, only 6 left
Related articles

OpenClaw for Business: The No-Code Guide to AI Automation in 2026
Learn how to use OpenClaw for business without coding. Customer service, lead gen, appointments, sales automation, and more. 3 paths to get started.

How to Run OpenClaw on Raspberry Pi: Complete 2026 Setup Guide
Step-by-step guide to install OpenClaw on Raspberry Pi 5 or 4. Hardware requirements, OS setup, Node.js, Telegram config, performance tips, and when a managed service makes more sense.

20+ OpenClaw Use Cases: Real Examples from Business to DevOps (2026)
Discover 20+ real OpenClaw use cases: customer service bots, personal assistants, content pipelines, DevOps automation, and more. Concrete examples with setup tips.