- Pairing is a one-time token validation handshake — not a manual approval step you take in Telegram
- The gateway must be running before you execute the
channels addcommand or pairing silently fails - A 401 error means wrong or expired token; a timeout means a network block to api.telegram.org
- Updating a token after BotFather revocation takes one command:
openclaw channels update telegram --token NEW_TOKEN - Use
openclaw channels statusto confirm the pairing is active — a "connected" state with recent heartbeat is the green light
More than half the support questions in the OpenClaw community about Telegram come down to one misunderstanding: people think "pairing" is a step they complete in Telegram. It's not. Pairing happens entirely on the OpenClaw side. Understanding what it actually does makes the whole process obvious — and makes failures trivial to fix.
What Telegram Pairing Actually Does
When you run openclaw channels add telegram --token YOUR_TOKEN, the gateway performs three things in sequence:
- Token validation — OpenClaw sends a
getMerequest to Telegram's Bot API using your token. Telegram returns your bot's username and ID. This confirms the token is valid and the bot exists. - Channel registration — OpenClaw records the channel in its internal channel registry with a generated channel ID, the bot's Telegram user ID, and the bot username.
- Polling initialization — OpenClaw starts a long-polling loop against Telegram's
getUpdatesendpoint. The bot is now live and listening for messages.
There is no step inside the Telegram app. There is no QR code to scan. There is no approval button. The "pairing" is purely an API handshake between your running gateway and Telegram's servers.
Here's where most people stop. They run the command, see no error — then wonder why the bot doesn't respond. The answer is almost always that step 3 completed but the channel wasn't assigned to an agent. We'll cover that below.
Prerequisites for Successful Pairing
Four things must be true before the pairing command will succeed:
- The OpenClaw gateway is running — run
openclaw gateway statusto confirm. If it's not running, start it withopenclaw gateway startbefore proceeding. - You have a valid Telegram bot token — obtained from BotFather via
/newbot. The token format isNUMBERS:ALPHANUMERIC_STRING. - Outbound HTTPS to api.telegram.org is not blocked — corporate networks and some VPS providers block outbound traffic to social/messaging APIs. Test with
curl https://api.telegram.orgfrom the machine running the gateway. - The token has not been revoked — if you previously used
/revokein BotFather, that token is dead. Generate a new one.
Validate the token manually before running the OpenClaw command. Hit this URL in your browser or with curl: https://api.telegram.org/bot YOUR_TOKEN/getMe. A valid token returns a JSON object with your bot's username. A 401 response means the token is wrong or revoked.
Running the Pairing Process Step by Step
Step 1: Confirm the Gateway Is Running
openclaw gateway status
# Expected output: Gateway running on port 8080 (or your configured port)
Step 2: Run the Channel Add Command
openclaw channels add telegram --token 7123456789:AAH4s8xKpQ-mT3nR_example_token_here
Successful output looks like this:
✓ Token validated: @myagent_bot (ID: 7123456789)
✓ Channel registered: telegram-default
✓ Polling started
Channel ID: telegram-default
Take note of the Channel ID. You'll need it in the next step.
Step 3: Assign the Channel to an Agent
This is the step most guides skip. A registered channel does nothing without an agent. Edit your agent config:
# agents/my-agent/config.yaml
channels:
- telegram-default
Then reload:
openclaw agents reload my-agent
Step 4: Verify the Pairing Is Active
openclaw channels status
# Expected output:
# ID TYPE STATE BOT LAST HEARTBEAT
# telegram-default telegram connected @myagent_bot 2s ago
A "connected" state with a heartbeat timestamp within the last 30 seconds confirms the pairing is working. The bot is live.
Diagnosing and Fixing Pairing Failures
Here's every error you'll encounter and what it means:
| Error | Cause | Fix |
|---|---|---|
| 401 Unauthorized | Token is wrong, expired, or revoked | Get a new token from BotFather |
| Connection timeout | Outbound HTTPS to api.telegram.org blocked | Whitelist api.telegram.org on port 443 |
| Gateway not running | channels add run before gateway start | Start gateway first, then re-run command |
| Conflict: 409 | Another poller is using the same token | Stop all other instances using this bot token |
| Channel already exists | Token was registered previously | Use openclaw channels update instead |
A 409 Conflict from Telegram's API means two polling instances are fighting over the same bot token. Only one wins messages at a time, and they alternate unpredictably. This happens when you have two OpenClaw instances both configured with the same token, or when a previous instance didn't shut down cleanly. Track down every running gateway and shut down the duplicate.
Updating a Token After BotFather Revocation
If you had to revoke your bot token (due to exposure or routine rotation), update the channel without losing your agent assignments:
openclaw channels update telegram --id telegram-default --token NEW_TOKEN_HERE
The channel ID stays the same. The agent config doesn't need to change. OpenClaw restarts the polling loop with the new token immediately.
Common Pairing Mistakes
- Copying the token with a trailing newline or space — terminal copy-paste often captures the newline character. Paste into a text editor first to verify the token length is correct before passing it to the command.
- Running channels add before gateway start — the gateway must be running because the channel registration is stored in the gateway's state. A cold CLI command without a running gateway has nowhere to write the registration.
- Assuming pairing means the bot is ready — pairing registers the channel. The bot is only active once that channel is assigned to an agent. Two separate steps, both required.
- Not checking heartbeat after pairing — a successful pairing can go stale if the polling loop crashes silently. Check
openclaw channels statusafter 60 seconds to confirm the heartbeat is recent. - Using the same token across multiple environments — development and production must have separate bot tokens from separate BotFather bots. One token, one active poller — no exceptions.
Frequently Asked Questions
What is the OpenClaw Telegram pairing step?
Pairing is the process where OpenClaw validates your bot token against Telegram's API and registers the channel in the gateway's channel registry. It's a one-time handshake between your OpenClaw gateway and Telegram's bot platform that must complete before messages flow.
Why does my Telegram pairing keep failing?
The three most common causes are: an incorrectly copied token (check for trailing spaces or missing characters), the OpenClaw gateway not running when you run the channels add command, and network issues blocking outbound HTTPS to api.telegram.org. Check openclaw logs for the specific error code.
How do I approve the Telegram channel in OpenClaw?
Run openclaw channels add telegram --token YOUR_TOKEN. If the token is valid and the gateway is running, the channel is approved automatically — no separate approval step is needed. The CLI output confirms success with the assigned channel ID. Then assign that channel ID to an agent.
Can I re-pair a Telegram bot after changing the token?
Yes. If you revoke and regenerate your bot token in BotFather, update OpenClaw with: openclaw channels update telegram --id CHANNEL_ID --token NEW_TOKEN. The channel retains its ID and agent assignments. No need to reconfigure the agent — just the token changes.
Does the pairing process require the bot to be added to a chat?
No. Token pairing happens between OpenClaw and Telegram's API directly — it doesn't require the bot to be in any chat. The bot becomes active for direct messages immediately after pairing. For group chats, the bot needs to be added to the group separately after pairing is complete.
What does the openclaw channels status command show for Telegram?
It shows the channel ID, type (telegram), connection state (connected, disconnected, error), the bot username, last heartbeat timestamp, and message count. A connected state with a recent heartbeat confirms the pairing is active and the gateway is successfully polling Telegram.
J. Donovan specializes in breaking down complex OpenClaw configuration problems into clear, step-by-step processes. Has documented hundreds of integration edge cases from the OpenClaw community and turned them into reproducible fixes.