Connect OpenClaw to Telegram: Complete Setup
Connect OpenClaw to Telegram in minutes. Create a bot, configure access, and start chatting.
Overview
Telegram is the quickest way to start using OpenClaw. In this guide, we'll create a Telegram bot, connect it to OpenClaw, and get you chatting with your AI assistant in minutes.
- A Telegram account
- OpenClaw installed (see Getting Started)
- Your bot token (we'll get this in step 1)
Create Your Telegram Bot
Telegram bots are created through BotFather, an official Telegram bot. Here's how:
Open Telegram
Launch the Telegram app on your phone or desktop and search for @BotFather.
@BotFather (blue checkmark). There are fake bots with similar names.Start the bot
Click Start or send /start to begin.
Create new bot
Send /newbot to create a new bot.
Name your bot
BotFather will ask for a name. This is the display name (e.g., "My OpenClaw Assistant").
Choose a username
Choose a unique username ending in bot (e.g., my_assistant_bot). This is how people will find and mention your bot.
Get Your Bot Token
After creating your bot, BotFather will show you a token that looks like this:
1234567890:ABCdefGHIjklMNOpqrsTUVwxyz/token in BotFather.Configure OpenClaw
Now let's tell OpenClaw about your Telegram bot. You can do this through the config file or environment variables.
Open your config.yaml (or create it from config.example.yaml) and add:
channels:
telegram:
enabled: true
botToken: "YOUR_BOT_TOKEN_HERE"Start the Gateway
Start OpenClaw and let it connect to Telegram:
openclaw gatewayYou should see logs indicating Telegram is connecting. Once connected, it's time to authorize yourself.
Pair Your Account
By default, Telegram DMs require pairing (authorization). Here's how to approve yourself:
Find your pairing code
Run this command in your terminal:
openclaw pairing list telegramYou'll see a code like ABC123.
Message your bot
Go to your bot in Telegram and send the code:
ABC123Approve the pairing
Back in your terminal:
openclaw pairing approve telegram ABC123Test It
Now let's verify everything works:
Send a message
Go to your bot on Telegram and send a message like "Hello!"
Wait for a response
Your AI assistant should respond. If it doesn't, check the troubleshooting section below.
Troubleshooting
Common issues and how to fix them:
Bot doesn't respond to messages
- Make sure you've completed the pairing process above
- Check that Telegram is enabled:
openclaw channels status - Check logs:
openclaw logs --follow
"setMyCommands failed" error
This usually means Telegram's API is blocked. Make sure your server can reach api.telegram.org.
Finding your Telegram user ID
Some configs require your numeric user ID. The easiest way:
- DM your bot
- Run
openclaw logs --follow - Look for
from.idin the logs