Connect Your First Channel
Connect Telegram so you can message your agent from your phone or desktop.
By the end of this page, you'll be able to send your agent a message on Telegram and get a reply.
Time: ~15 minutes
Why Telegram first
OpenClaw supports many channels — WhatsApp, iMessage, Slack, Discord, and more. For your first channel, Telegram is the right choice:
- No phone number pairing required
- Official Bot API — no unofficial libraries, no workarounds
- Works on any device (phone, desktop, web)
- Free and fast to set up
Step 1 — Create a Telegram bot
- Open Telegram and search for @BotFather
- Send
/newbot - Enter a name for your bot (e.g. "My OpenClaw Agent")
- Enter a username — must end in
bot(e.g.my_openclaw_bot) - BotFather will reply with your bot token — a string like
123456789:ABCdef...
Copy that token. You'll need it in the next step.
Step 2 — Add the channel to your config
Open ~/.openclaw/openclaw.json in a text editor. On macOS, the quickest way is:
open -e ~/.openclaw/openclaw.jsonThat opens it in TextEdit. Alternatively, use VS Code (code ~/.openclaw/openclaw.json) or any other editor you're comfortable with. On Windows (WSL2), run explorer.exe . from inside WSL to browse to the file in Explorer.
Your openclaw.json already has content from the setup wizard (your API key, workspace path, etc.). You need to add a channels key into the existing JSON object — don't replace the whole file.
Here's what the relevant part should look like after editing:
{
"provider": "...",
"channels": {
"telegram": {
"token": "YOUR_BOT_TOKEN_HERE",
"dmPolicy": "pairing"
}
}
}The provider line represents whatever config the wizard already created. You're only adding the "channels" block. If your file already has a "channels" key, add "telegram" inside it.
Replace YOUR_BOT_TOKEN_HERE with the token from BotFather.
After saving, validate the file isn't broken:
openclaw config validateIf it reports an error, you have a JSON syntax problem — usually a missing comma or extra bracket. Common editors show JSON errors inline.
What dmPolicy does:
"pairing"(default) — Someone must be approved before they can message your agent. You'll approve yourself on first contact."allowlist"— Only specific numeric user IDs can message the agent (useallowedUsers)"open"— Anyone who finds the bot can message it
"pairing" is the right default while you're getting started. To switch to an allowlist later, add allowedUsers with numeric IDs:
{
"channels": {
"telegram": {
"token": "YOUR_BOT_TOKEN_HERE",
"dmPolicy": "allowlist",
"allowedUsers": [123456789]
}
}
}To find your Telegram user ID, message @userinfobot on Telegram — it replies with your numeric ID.
Step 3 — Restart the Gateway
openclaw gateway restartThen verify it loaded the channel:
openclaw gateway statusYou should see telegram: connected in the output.
Step 4 — Pair your account
- Open Telegram on your phone or desktop
- Search for your bot by username (e.g.
@my_openclaw_bot) - Send
/start
Once you send /start, a pairing request is created. The easiest way to approve it:
openclaw channels pairThis shows a list of pending requests — select yours to approve it. Your bot will send you a confirmation message in Telegram once approved.
Alternatively, if you know the pairing code (shown in openclaw logs --filter telegram):
# Replace 1234 with the actual code from the logs
openclaw pairing approve telegram 1234From now on, your account is trusted and you can message the bot freely.
Step 5 — Send a message
Go back to Telegram and send your agent a message. It should respond within a few seconds.
Try: "What can you do?"
What just happened
The flow from your Telegram message to the response:
- Telegram sends your message to OpenClaw's webhook
- The Gateway receives it and checks your pairing status
- Loads your
SOUL.mdandUSER.mdfor context - Sends the conversation to your AI provider's API
- Streams the reply back through Telegram
Your agent is now reachable from anywhere you have Telegram.
Troubleshooting
| Problem | Fix |
|---|---|
| Bot doesn't respond | Check openclaw logs — usually a token error or gateway not running |
telegram: not connected in status | Verify token in config has no extra spaces or quotes |
| Pairing request doesn't appear | Make sure you sent /start first |
| Slow responses | Normal — your AI provider API adds latency, not OpenClaw |