What You Will Achieve
By following this guide, you will connect OpenClaw to Telegram. Once connected, you can send messages to your Telegram bot and receive AI-powered responses. This is one of the most popular ways to use OpenClaw because Telegram works on phones, tablets, and computers.
What is a Telegram Bot?
A Telegram bot is like an automated account that can receive and send messages. You will create your own bot, and OpenClaw will control it. When you send a message to your bot, OpenClaw receives it, asks the AI for a response, and sends the reply back to you through Telegram.
Before You Start
Make sure you have completed these steps:
- OpenClaw is installed and running on your computer
- You have a Telegram account (free to create at telegram.org)
- Telegram app is installed on your phone or computer
Check OpenClaw Status First
Before continuing, open your terminal and run openclaw status. You should see "Gateway: running". If not, start OpenClaw first by running openclaw gateway --daemon.
Verify OpenClaw is running:
openclaw status
Expected Result
Gateway: running Port: 18789 Auth: configured
Understanding the Process
Here is what we will do:
- Create a Telegram bot using Telegram's official bot creation tool (BotFather)
- Get a Bot Token (a secret password that lets OpenClaw control your bot)
- Add the token to OpenClaw so it can connect to your bot
- Test the connection by sending a message
What is a Bot Token?
A Bot Token is a long string of letters and numbers that acts like a password for your bot. Anyone with this token can control your bot, so keep it secret. It looks something like: 7123456789:AAHxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxx
Step-by-Step Setup
Open Telegram and Find BotFather
BotFather is Telegram's official tool for creating bots. It is itself a bot that you chat with to create new bots.
On your phone or computer:
- Open the Telegram app
- Tap the search icon (magnifying glass)
- Type
@BotFatherin the search box - Look for the account with a blue checkmark (this is the official BotFather)
- Tap on BotFather to open a chat
Watch Out for Fakes
There are fake BotFather accounts. The real BotFather has a blue verification checkmark next to its name and the username is exactly @BotFather (capital B and F). Do not use any other account.
Expected Result
You are now in a chat with BotFather. You should see a welcome message and a list of commands.
Create Your Bot
Now we will tell BotFather to create a new bot for you.
In the BotFather chat:
- Type
/newbotand send the message - BotFather will ask: "Alright, a new bot. How are we going to call it?"
- Type a name for your bot (this is what people see, like "My AI Assistant")
- Send the message
- BotFather will ask for a username for your bot
- Type a username that ends with
bot(likemyai_assistant_botorJohnAIBot)
Choosing a Bot Username
The username must:
- End with
botorBot(likemyassistant_bot) - Be unique (not already taken by another bot)
- Only contain letters, numbers, and underscores
- Be at least 5 characters long
If your chosen name is taken, try adding numbers or underscores, like myassistant_2024_bot.
Expected Result
BotFather responds with: "Done! Congratulations on your new bot." You will see your Bot Token displayed in the message. It looks like: 7123456789:AAHdqTxxxxxxxxxxxxxxxxxxxxxxxx
Important: Copy your Bot Token now! You will need it in the next step. Tap and hold the token to copy it, or write it down somewhere safe.
Add the Bot Token to OpenClaw
Now we need to tell OpenClaw about your new bot by giving it the token. There are two ways to do this:
Method A: Using Environment Variable (Recommended for beginners)
Set the token as an environment variable before starting OpenClaw:
export TELEGRAM_BOT_TOKEN="7123456789:AAHdqTxxxxxxxxxxxxxxxxxxxxxxxx"
Make It Permanent
To keep this setting after restarting your computer, add the export line to your ~/.bashrc or ~/.zshrc file.
Method B: Using Configuration File
Edit the OpenClaw configuration file at ~/.openclaw/openclaw.json:
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "7123456789:AAHdqTxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
How to Edit the Config File
- On Mac/Linux: Run
nano ~/.openclaw/openclaw.jsonin Terminal - On Windows (WSL): Run
nano ~/.openclaw/openclaw.jsonin Ubuntu - Save the file with Ctrl+O, then exit with Ctrl+X
Expected Result
After saving, your configuration file contains your Telegram bot token.
If you see an error later, double-check that you copied the entire token correctly. The token is quite long and easy to miss characters.
Restart the OpenClaw Gateway
For the new channel to work, we need to restart OpenClaw's gateway.
openclaw gateway restart
Wait a few seconds for the gateway to restart.
Expected Result
Stopping gateway... Starting gateway... Gateway started successfully Channels: telegram (connected)
Send Your First Message
Now let us test that everything works!
On Telegram:
- Go back to Telegram
- Search for your bot by its username (the one ending in
botthat you created) - Open a chat with your bot
- Type a message like "Hello!" and send it
First Message: Pairing Required
The first time you message your bot, OpenClaw needs to verify that you are allowed to use it. This is called "pairing" and it prevents strangers from using your AI.
What happens next:
- Your bot will reply with a pairing code (a 6-digit number)
- Go to your terminal and run:
openclaw pairing list telegram
You will see your pending pairing request with the code.
- Approve the pairing:
openclaw pairing approve telegram 123456
Replace 123456 with the actual pairing code shown.
Expected Result
Pending pairing requests: [1] Telegram: @your_username (Code: 123456)
Approve which request? 1 Pairing approved for @your_username
Test Your AI Connection
Now that pairing is complete, send another message to your bot:
- Go to Telegram
- Open the chat with your bot
- Type "What can you help me with?" and send
Expected Result
Your bot should respond with an AI-generated message within a few seconds.
Congratulations!
You have successfully connected OpenClaw to Telegram! You can now chat with AI through Telegram on any device.
Common Problems and Solutions
Bot does not respond at all
Check if OpenClaw is running:
openclaw status
If the gateway is not running, start it:
openclaw gateway --daemon
"Invalid token" error
This means the Bot Token you entered is incorrect.
Solution:
- Go back to BotFather on Telegram
- Send
/mybots - Select your bot
- Click "API Token" to see your token again
- Copy the entire token carefully
- Run
openclaw channels remove --channel telegramthenopenclaw channels add --channel telegram --token YOUR_TOKENagain
Pairing code not appearing
If you sent a message but did not receive a pairing code:
- Make sure the gateway is running:
openclaw status - Check the logs for errors:
openclaw logs --limit 20 - Try restarting the gateway:
openclaw gateway restart
Bot replies very slowly
Slow responses are usually caused by:
- Slow internet connection: Check your internet
- AI provider issues: The AI service might be experiencing high load
- First message delay: The first message after starting OpenClaw may be slower
"Channel already exists" error
If you already added Telegram before:
openclaw channels remove --channel telegram
openclaw channels add --channel telegram --token YOUR_TOKEN
This removes the old configuration and lets you start fresh.
Bot says "Pairing required" every time
This happens if pairing was not completed or was rejected.
openclaw pairing list telegram
If you see pending requests, approve them:
openclaw pairing approve telegram CODE
Replace CODE with the actual pairing code.
Customizing Your Bot
Change Bot Profile Picture
- Open BotFather on Telegram
- Send
/mybots - Select your bot
- Click "Edit Bot"
- Click "Edit Botpic"
- Send an image to use as profile picture
Change Bot Description
- Open BotFather on Telegram
- Send
/mybots - Select your bot
- Click "Edit Bot"
- Click "Edit Description"
- Type the description users will see when they first open a chat
Add Bot Commands Menu
You can add a menu of commands that appears when users type /:
- Send
/mybotsto BotFather - Select your bot
- Click "Edit Bot"
- Click "Edit Commands"
- Send a list in this format:
help - Show help message
start - Start chatting
status - Check bot status
Security Tips
Keep Your Bot Token Secret
Never share your Bot Token with anyone. If someone gets your token, they can control your bot. If you think your token was leaked, revoke it immediately through BotFather.
To revoke and get a new token:
- Open BotFather
- Send
/mybots - Select your bot
- Click "API Token"
- Click "Revoke current token"
This will generate a new token. Remember to update OpenClaw with the new token:
openclaw channels remove --channel telegram
openclaw channels add --channel telegram --token YOUR_TOKEN
Using Telegram on Multiple Devices
One great thing about Telegram is that it works on multiple devices at the same time. Once you set up OpenClaw:
- Chat with your AI on your phone while on the go
- Continue the conversation on your computer at home
- Use Telegram Web (web.telegram.org) from any browser
Your conversation history syncs across all devices automatically.
What To Do Next
Now that Telegram is connected, explore these options:
- Connect to Discord - Add AI to your Discord server
- Connect to WhatsApp - Use AI through WhatsApp
- Multi-Channel Setup - Use multiple platforms at once
- Your First Agent - Learn to customize AI responses
Need Help?
If you run into problems not covered here, check our Troubleshooting guide or visit the official OpenClaw documentation.
Last updated: February 3, 2026 | Found an error? Contact us