Connecting OpenClaw to Telegram lets you interact with your agent from your phone or any device with Telegram. Once connected, just message the bot and the agent responds.
1. Create a Telegram bot
- Open Telegram and search for @BotFather
- Send
/newbot - Follow the prompts, choose a name and username for your bot
- BotFather will give you a bot token like
1234567890:ABCDEFghijklmnopqrstuvwxyz
Copy this token, you’ll need it in the next step.
2. Add Telegram channel to OpenClaw
openclaw channels add telegram When prompted, paste your bot token.
Alternatively, add it directly to ~/.openclaw/openclaw.json:
{
"channels": {
"telegram": {
"enabled": true,
"token": "1234567890:ABCDEFghijklmnopqrstuvwxyz"
}
}
} 3. Restart the gateway
openclaw gateway restart 4. Test the connection
Open Telegram, find your bot by its username, and send a message:
Hello, are you there? The agent should respond. If it doesn’t, check gateway logs:
openclaw gateway logs 5. Restrict access (recommended)
By default, anyone who finds your bot can message it. To restrict access to yourself only, add your Telegram user ID to the allowlist.
First, find your user ID: message @userinfobot on Telegram and it will reply with your numeric ID.
Then update openclaw.json:
{
"channels": {
"telegram": {
"enabled": true,
"token": "1234567890:ABCDEFghijklmnopqrstuvwxyz",
"allowlist": ["123456789"]
}
}
} Restart the gateway after saving.
Anyone with your bot token can impersonate your bot. Never share it publicly or commit it to version control.
6. Useful chat commands
Once connected, these slash commands work inside the Telegram chat:
| Command | What it does |
|---|---|
/new | Start a new session |
/reset | Reset the current session |
/compact | Compress context to free space |
/stop | Stop the current task |
/status | Show agent status |
/context | Show current session context size |
Troubleshooting
Bot doesn’t respond: Check openclaw gateway status and openclaw gateway logs for errors.
Token invalid error: Make sure you copied the full token from BotFather without extra spaces.
Gateway not running: Run openclaw gateway start or check if the daemon is enabled with openclaw gateway status.