OpenClaw Telegram Integration Guide: Complete Tutorial from Bot Creation to Configuration
It was 2 AM, and I was staring at my code debugging window when a question popped into my head that needed AI help. Opening the browser, logging into the ChatGPT website, waiting for it to load—the whole process took several minutes. At that moment, I thought, wouldn’t it be great if I could just ask my AI assistant directly on Telegram, as naturally as chatting with a friend?
Later, I discovered that implementing this was much simpler than I imagined. OpenClaw paired with Telegram Bot—done in half an hour. You don’t need to understand complex backend development or worry about server configuration. Follow this tutorial, and you too can have a 24/7 AI personal assistant.
Honestly, the first time I saw the Bot reply to me on Telegram, that sense of accomplishment felt pretty amazing. Today, I’ll walk you through the entire process step by step, including the pitfalls I’ve encountered and common troubleshooting methods. Ready? Let’s get started.
Quick integration checklist
If you want the fastest reliable setup:
- Create bot in BotFather and store token securely.
- Configure
channels.telegramwith strictdmPolicy. - Keep
allowFromminimal for production. - Restart gateway and verify with a real DM test.
Preparation: Basic Concepts You Need to Know
Before diving in, let’s clarify a few key concepts. This isn’t a boring theory lesson—understanding these will save you from many detours.
Telegram Bots aren’t regular accounts. They’re more like automated reply robot interfaces that can receive and send messages but can’t initiate conversations. Think of them like customer service chatbots—they only respond when you ask questions.
Who is BotFather? This is Telegram’s official “Bot factory” where all Bots are created. It’s itself a Bot, and you create and configure your own Bot by chatting with it. When I first heard about it, I thought it was pretty clever—using a Bot to manage Bots.
What role does OpenClaw play here? Simply put, it’s the bridge connecting Telegram and AI large language models. Telegram handles receiving messages, OpenClaw receives them and forwards to Claude or GPT, then sends the AI’s reply back to Telegram. You don’t need to write any code for the entire process.
What you need to prepare:
- A Telegram account (you should already have one)
- OpenClaw installed and running (if not installed yet, refer to the official documentation or my previous installation tutorial)
- AI model API Key (Claude, GPT, Gemini all work—free tier options available for testing)
Honestly, these preparations aren’t complicated. OpenClaw supports multiple platforms (Telegram, WhatsApp, WeChat, etc.) and various AI models, and switching models is easy after configuring once.
Step 1: Create Your Telegram Bot via BotFather
Alright, let’s get to the main event. Open Telegram, type @BotFather in the search box, and look for the official account with the blue verification badge. Don’t click the wrong one—there are plenty of fakes.
The Bot creation conversation flow is super simple:
- Send the
/newbotcommand to BotFather - It will ask for your Bot’s display name—pick something nice, like “My AI Assistant”
- Then you need to set a username, which has rules: must end with
botand be globally unique. My first attempt withAIAssistantBotwas taken, and it took three or four tries to succeed
If you encounter “username already taken,” try adding some numbers or your name initials, like MyAwesomeAI2024Bot.
Getting the Bot Token is the most critical step. After successful creation, BotFather will send you a long string of characters, formatted something like this:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz1234567890
This Token is as important as your house keys. I’ve seen people accidentally commit Tokens to public GitHub repositories, resulting in quota depletion and losses of hundreds of dollars. I suggest you immediately copy it to a password manager or encrypted notes—never send it to chat logs or cloud notes.
Optional but recommended configurations:
- Use
/setdescriptionto set a Bot description that users will see when opening the Bot - Use
/setabouttextto set “About” information - Use
/setuserpicto upload an avatar to look more professional
Don’t forget to get your own Telegram user ID! You’ll need this when configuring the whitelist later. In Telegram, search for @userinfobot, send it /start, and it will return your numeric ID, looking something like 123456789. Write this down too.
Step 2: Configure OpenClaw’s Telegram Channel
After getting the Bot Token, next is configuring OpenClaw. This step looks a bit technical, but basically it’s just editing a JSON file.
Find the configuration file. As of 2026, OpenClaw typically stores state under ~/.openclaw/, with the main file openclaw.json. Telegram fields live under channels.telegram—see the official Telegram channel documentation. Paths like ~/.clawdbot/config/channels.json are legacy; migrate using the rename article in this series. With Docker, confirm your volume mounts match OPENCLAW_HOME / ~/.openclaw.
Below is an illustrative JSON fragment for a single-owner allowlist setup. Official defaults often use pairing for DMs; first-time chats may require openclaw pairing approve telegram … on the gateway host. Do not treat random nested channels arrays from old posts as canonical.
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "YOUR_BOT_TOKEN_HERE",
"dmPolicy": "allowlist",
"allowFrom": [123456789]
}
}
}
What matters (aligned with upstream docs):
botToken: paste from BotFather—no extra spaces or line breaksdmPolicy/allowFrom: who may DM your bot in allowlist modeenabled: turn the channel on or off- If you use pairing instead, follow the official “start gateway + approve pairing” flow
How to edit this file?
On Linux or macOS:
nano ~/.openclaw/openclaw.json
With Docker, edit the mounted path inside the container (path depends on your compose file):
docker exec -it openclaw sh
vi /root/.openclaw/openclaw.json
Common mistakes:
- Strict JSON (no trailing comma after the last field)
- Hidden whitespace in tokens
- Policy mismatch: pairing not approved, or allowlist missing
allowFrom
My first configuration had an extra comma, causing OpenClaw startup failure, and it took forever searching logs to find it. JSON format checking tools (like online JSONLint) can help you avoid these rookie mistakes.
Step 3: Set Whitelist to Protect Your Bot
Speaking of whitelists, this is really important. Imagine if your Bot Token accidentally leaked—anyone in the world could use your Bot and consume your AI quota. A friend of mine experienced this; a month’s Claude quota was gone in three days.
Why you must set a whitelist:
- Prevent strangers from abusing your AI quota (this is real money)
- Avoid sensitive information leaks (your conversations with AI might contain work content)
- Control usage costs (especially with expensive models like GPT-4)
How to configure access? The field you usually want for a numeric allowlist is channels.telegram.allowFrom, together with dmPolicy.
Single user (under channels.telegram):
"dmPolicy": "allowlist",
"allowFrom": [123456789]
Team use:
"dmPolicy": "allowlist",
"allowFrom": [123456789, 987654321, 555555555]
How to get Telegram user IDs:
- Ask teammates to DM
@userinfobotand send/start(official docs also recommend readingfrom.idfromopenclaw logs --followfor privacy) - Collect numeric IDs
- Append them to
allowFrom
For teams, keep a small roster (ID ↔ name). Remove IDs when people leave.
About pairing (official default for many setups):
Telegram DMs often default to pairing: approve with the pairing subcommand on the gateway host (see docs.openclaw.ai/channels/telegram). For a simple “ID-only gate”, use dmPolicy: "allowlist" and list your numeric ID in allowFrom.
Step 4: Start the Gateway and Test
Configuration complete—time to run the Gateway and verify Telegram.
Start the Gateway:
If locally installed:
openclaw gateway
# or, if you installed a system service:
openclaw gateway start
If deployed with Docker:
docker compose up -d
Check service status:
After starting, check logs to confirm the Telegram Channel loaded successfully. With Docker:
docker compose logs openclaw -f
You should see logs similar to this:
[INFO] Loading Telegram channel: telegram-main
[INFO] Telegram bot connected successfully
[INFO] Listening for messages...
If you see error messages, don’t panic—write down the error content, we have a troubleshooting checklist coming up.
First conversation test (this is the most exciting moment):
- Search for your Bot username in Telegram (the one ending with
botthat you created) - Click the
Startbutton at the bottom of the chat window - Send a test message, like “Hello” or “Hi there”
- If everything’s working, the Bot will reply with AI-generated content in a few seconds
The first time I saw the Bot reply, I was genuinely a bit excited. That feeling is like you built a robot with your own hands, and it can actually chat with you.
If the Bot doesn’t respond, what should you do? Don’t rush to reinstall—read the troubleshooting checklist below; 90% of issues can be quickly resolved.
Common Troubleshooting Checklist
Bot not responding? Configuration not taking effect? Don’t panic, let’s troubleshoot step by step. I’ve organized all the problems I’ve encountered into a checklist—following it will solve most issues.
Problem 1: Bot completely doesn’t respond to any messages
This is the most common problem, with several possible causes. Check in this order:
- Is the OpenClaw service running? Confirm with
docker psorps aux | grep openclaw - Is the Bot Token correct? Check
channels.telegram.botTokenin~/.openclaw/openclaw.json—no extra spaces - Under allowlist, is your user ID in
allowFrom? Under pairing, did you approve the code on the gateway host? - Is the config file’s JSON format correct? Check with an online JSONLint tool
- Is the AI model’s API Key valid and have quota? Log into the AI provider’s backend to check balance
Diagnostic commands:
# View OpenClaw logs
docker compose logs openclaw -f
# Check config file format
cat ~/.openclaw/openclaw.json | jq .
Problem 2: Getting “Unauthorized” or “Forbidden” errors
This error is almost always a whitelist issue. Check:
- With
dmPolicy: "allowlist", is your Telegram user ID listed inallowFrom(see official ID formats) - With pairing, did you run the approve flow documented upstream?
- Remember to restart OpenClaw service after modifying config
Problem 3: Bot responds very slowly
If the Bot takes a long time to reply, possible reasons:
- AI model API responds slowly (especially during peak hours)
- Network connection issues (check server to AI provider network)
- Insufficient server resources (check CPU and memory usage)
Improvement methods:
- Try a faster AI model
- If using GPT-4, try GPT-3.5 or Claude 3 Haiku first
- Upgrade server configuration or optimize network
Problem 4: Config file changes don’t take effect
I’ve encountered this too—changed config for ages and nothing worked. Reason: forgot to restart the service.
Solution:
docker compose restart
# or
systemctl restart openclaw
Problem 5: How to view Bot conversation history
OpenClaw saves conversation records locally. You can:
- View log files (default path)
- Use OpenClaw’s Control UI (if enabled)
- Directly view the database (SQLite or other configured database)
Problem 6: What to do if Bot Token leaks
If you accidentally commit Token to a public repo or it leaks:
- Immediately use the
/revokecommand in BotFather to revoke Token - Use the
/tokencommand to generate a new Token - Update OpenClaw config file
- Restart service
- Check AI provider usage to see if it was abused
Advanced Configuration (Optional)
Basic functionality is already sufficient, but if you want to play with advanced features, OpenClaw has plenty more to explore.
Configure welcome message and command menu:
In BotFather, you can use /setcommands to set a command menu for the Bot, like:
start - Start conversation
help - View help
clear - Clear conversation history
Users will see these command hints when typing /.
Enable DM pairing mode:
If you want multiple people to use it but don’t want to manually manage the whitelist, try pairing code mode:
"enableDmPairing": true
OpenClaw will generate a pairing code that users enter on first use to activate. This suits offering as a service to others.
Configure different AI models for different users:
OpenClaw supports assigning different AI models per user. For example, admins use GPT-4, regular users use GPT-3.5. Specific configuration can be found in OpenClaw’s official documentation Multi-Model section.
Integrate OpenClaw Skills:
Skills is OpenClaw’s killer feature, allowing the AI assistant to perform actual operations, such as:
- File management (create, read, edit files)
- Shell command execution
- Web search
- Code writing and debugging
However, Skills functionality should be enabled cautiously, especially shell command execution, which has significant security risks.
Set conversation memory and personalized responses:
OpenClaw automatically saves conversation history. You can configure memory length, personalized prompts, etc., to make the AI assistant better suited to your usage habits.
I won’t expand on these advanced features—if interested, dive deep into OpenClaw’s official documentation.
Conclusion
After all that, looking back, the entire process isn’t complicated. From creating a Bot in BotFather, getting the Token, to configuring OpenClaw, setting the whitelist, and testing—the whole process takes half an hour at most.
Recap of the easiest places to make mistakes:
- Bot Token must be properly safeguarded, don’t commit to public repositories
- Whitelist configuration is key to security, don’t skip this step for convenience
- JSON format must be strict, one extra comma will cause configuration failure
- Remember to restart service after changing config, or it won’t take effect
If you followed this tutorial, you should now have a working Telegram AI assistant. Open Telegram and ask it questions anytime—no need to open a browser, log into a website, wait for loading. The experience is so much better.
What you can do next:
- Try different AI models to see which suits your needs better
- Explore OpenClaw’s Skills functionality to let your AI assistant perform actual operations
- If it works well, you can also configure it for team members
OpenClaw doesn’t just support Telegram—it can also integrate with WhatsApp, Enterprise WeChat, and other platforms. Master this configuration method, and other platforms are similar.
When you encounter problems, don’t panic. Review the troubleshooting checklist, or ask in the OpenClaw community. The fun of tinkering with these tools is exactly this—every time you solve a problem, you learn something new.
Now, go chat with your AI assistant!
Next Steps and Related Reading
After Telegram is live, continue with:
- OpenClaw Configuration Best Practices
- OpenClaw Security Hardening Guide
- OpenClaw Troubleshooting Guide
Complete OpenClaw Telegram Bot Configuration Process
Build a Telegram AI assistant from scratch, including Bot creation, OpenClaw configuration, security settings, and testing verification
⏱️ Estimated time: 30 min
- 1
Step1: Create Telegram Bot via BotFather
Creation steps:
1. Search for @BotFather in Telegram (look for blue verification badge)
2. Send /newbot command to start creation
3. Enter Bot display name (can be anything)
4. Set username (must end with bot, globally unique)
Get key information:
• Bot Token: Format like 123456789:ABCdefGHIjklMNOpqrsTUVwxyz1234567890
• Save immediately to password manager, never leak
• Search @userinfobot to get your user ID (needed for whitelist)
Optional configuration (recommended):
• /setdescription - Set Bot description
• /setabouttext - Set about information
• /setuserpic - Upload avatar - 2
Step2: Configure openclaw.json (Telegram)
Find config file:
• Default path: ~/.openclaw/openclaw.json
• Docker: confirm the mounted directory matches OPENCLAW_HOME / ~/.openclaw
Edit configuration (single-owner allowlist example; fields are authoritative in official docs):
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "YOUR_BOT_TOKEN_HERE",
"dmPolicy": "allowlist",
"allowFrom": [123456789]
}
}
}
Key points:
• botToken from BotFather
• dmPolicy + allowFrom control DM access; pairing flow in official Telegram doc
• enabled toggles the channel
Common errors:
• Invalid JSON
• Hidden whitespace in tokens
• Policy mismatch (pairing not approved / allowlist missing allowFrom) - 3
Step3: Configure access control (allowlist example)
Get user ID:
1. Search @userinfobot in Telegram (or use logs per official docs)
2. Send /start
3. Record numeric ID
Single user:
"dmPolicy": "allowlist",
"allowFrom": [123456789]
Team:
"allowFrom": [123456789, 987654321, 555555555]
Security essentials:
• Only add trusted users
• Review allowFrom when people leave
• Token leaks can be expensive - 4
Step4: Start Gateway and test
Local:
openclaw gateway
# or installed service:
openclaw gateway start
Docker:
docker compose up -d
Logs:
docker compose logs openclaw -f
Test:
1. Open your Bot in Telegram
2. Tap Start
3. Send a test message
4. If using pairing, approve on the gateway host per official docs
Restart after edits:
docker compose restart - 5
Step5: Common problem troubleshooting
Bot not responding checklist:
• Gateway running (docker ps or ps aux | grep openclaw)
• Token correct under channels.telegram.botToken
• allowFrom / pairing policy satisfied
• Valid JSON (JSONLint)
• AI API key valid with quota
Unauthorized / no reply:
• allowlist: user ID in allowFrom
• pairing: approve step completed
• Restart Gateway / container after edits
Slow replies:
• Try a faster model
• Check network and host resources
Token leak:
1. /revoke in BotFather
2. /token for a new secret
3. Update ~/.openclaw/openclaw.json
4. Restart
5. Check provider usage
FAQ
Why doesn't the Bot respond to my messages?
1. User ID not in allowFrom (allowlist) or pairing not approved: confirm Telegram ID and channels.telegram section
2. Bot Token misconfigured: check channels.telegram.botToken in openclaw.json—no extra spaces
3. OpenClaw service not running: Use docker ps or ps aux | grep openclaw to confirm service status
4. JSON format error: Use online JSONLint tool to check config file format
5. AI API quota exhausted: Log into AI provider backend to check balance
Follow this order to troubleshoot, and you can usually quickly identify the issue.
How do I add access permissions for team members?
1. Have members search @userinfobot in Telegram
2. Send /start to get user ID (numeric format)
3. Add IDs to allowFrom (consistent with dmPolicy):
"allowFrom": [123456789, 987654321, 555555555]
4. Restart OpenClaw service for config to take effect
Management recommendations:
• Maintain documentation of ID to name mappings
• Remove from whitelist promptly when members leave
• Regularly review whitelist for security
• For pairing, follow docs.openclaw.ai/channels/telegram (pairing approve subcommand with the code shown in your console)
What should I do if the Bot Token leaks?
1. Immediately revoke Token: Send /revoke command in BotFather
2. Generate new Token: Send /token to get new Token
3. Update config: edit ~/.openclaw/openclaw.json with the new token
4. Restart service: docker compose restart for new config to take effect
5. Check damage: Log into AI provider backend to view usage statistics
Prevention measures:
• Don't commit Token to public GitHub repositories
• Use password manager to save Token
• Don't save in plain text in chat logs or cloud notes
• Configure whitelist to restrict access
• Token leak cases have resulted in hundreds of dollars in losses
Can I configure different AI models for different users?
Implementation method:
1. Set up multiple AI models in OpenClaw configuration
2. Use user groups or permission config to assign models
3. For example: Admins use GPT-4, regular users use GPT-3.5
Specific configuration steps refer to OpenClaw official documentation's Multi-Model chapter. This feature suits team use and can control costs and access permissions.
Other advanced features:
• Skills integration (file management, shell execution, web search)
• Conversation memory configuration
• Personalized prompt settings
• Custom command menus
What other platforms can OpenClaw integrate with?
Supported platforms:
• Telegram (covered in this tutorial)
• Enterprise WeChat
• Discord
• Slack
Configuration method is similar:
1. Create Bot or app on corresponding platform
2. Get API credentials (Token/Key)
3. Configure the channel in openclaw.json
4. Set whitelist or permission control
5. Start service and test
After mastering Telegram configuration, other platforms are quite similar. Specific configuration for each platform can be found in OpenClaw official documentation's corresponding chapters.
Why don't config file changes take effect?
Correct operation process:
1. Edit ~/.openclaw/openclaw.json
2. Save file
3. Restart OpenClaw service:
• Docker: docker compose restart
• System service: systemctl restart openclaw
• Local run: Stop process then restart
4. Check logs to confirm config loaded successfully
Other possible reasons:
• JSON format error causing config load failure (check logs)
• Edited wrong config file (confirm mount path)
• File permission issues (ensure OpenClaw process can read)
• Config overridden by other config (check priority)
Recommend checking startup logs after every config change to confirm no errors.
How do I view the Bot's conversation history?
Method 1: Logs
• CLI: openclaw logs --follow (see official docs)
• Docker: docker compose logs openclaw
Method 2: Control UI (if enabled)
• Web UI for sessions when enabled upstream
Method 3: Session / data files
• Storage layout depends on version and config—usually under ~/.openclaw/; follow official Session / Memory docs
Privacy recommendations:
• Regularly clean sensitive conversation records
• Pay attention to database file access permissions
• Clarify data retention policy for team use
12 min read · Published on: Feb 5, 2026 · Modified on: Apr 16, 2026
OpenClaw Deployment & Practice
If you landed here from search, the fastest way to build context is to jump to the previous or next post in this same series.
Previous
Complete OpenClaw WhatsApp Integration Guide: From Configuration to Practice
A comprehensive guide to integrating OpenClaw with WhatsApp, covering three connection methods, permission configuration, message routing setup, QR code scanning steps, and troubleshooting common issues.
Part 17 of 35
Next
OpenClaw Gmail Integration in Action: Automated Email Classification & Smart Replies with secure-gmail Skill
Implement Gmail automation with OpenClaw's secure-gmail skill, featuring OAuth 2.0 configuration, email classification, draft generation, priority sorting, and secure local data storage.
Part 19 of 35
Related Posts
The Complete OpenClaw Renaming Saga: From Clawdbot to Moltbot to OpenClaw
The Complete OpenClaw Renaming Saga: From Clawdbot to Moltbot to OpenClaw
Complete OpenClaw Installation Guide: From Environment Setup to First Run
Complete OpenClaw Installation Guide: From Environment Setup to First Run
OpenClaw Cloud vs Local Deployment: Which Setup Should You Choose?

Comments
Sign in with GitHub to leave a comment