February 16, 2026

OpenClaw - Setting Up Two Telegram Bots with Pairing

OpenClaw

OpenClaw - Setting Up Two Telegram Bots with Pairing

openclaw --version
2026.2.14

Overview

OpenClaw can receive messages from more than one Telegram bot in the same gateway. The key idea is to configure multiple Telegram accounts inside the Telegram channel section, and then use an accountId to tell them apart when you route messages. This lets you run one gateway that listens to two bot tokens at the same time, without one token replacing the other.

Configuring Telegram as Multi Account

If your current config uses a single botToken directly under channels.telegram, that is the single account format. To add a second bot, move the token into an accounts object and create two entries, each with its own botToken. Your existing shared settings such as enabled, dmPolicy, groupPolicy, and streamMode can stay at the Telegram channel level and will apply to both bots unless you override something inside a specific account.

vi ~/.openclaw/openclaw.json

When you install OpenClaw and go through the initial setup, if you configure a Telegram bot, your configuration file will look something like this:

BEFORE

"channels": { "telegram": { "enabled": true, "dmPolicy": "pairing", "botToken": "<TOKEN_A>",
"groupPolicy": "allowlist", "streamMode": "partial", "groups": { "-5.........": { "groupPolicy": "open", "requireMention": false } } }
}

AFTER

"channels": { "telegram": { "enabled": true, "dmPolicy": "pairing", "groupPolicy": "allowlist", "streamMode": "partial", "accounts": { "default": { "name": "Bot A", "botToken": "<TOKEN_A>" }, "botB": { "name": "Bot B", "botToken": "<TOKEN_B>" } }, "groups": { "-5.........": { "groupPolicy": "open", "requireMention": false } } } }

Approving Pairing Requests

After you add the configuration and run the gateway, Telegram provides a pairing token. (You might need to run /start in the bot (or just say “hi”). My bot automatically sent me the token. I’m not sure if that’s because I previously configured Bot A (but later replaced it with Bot B). Now I want to use both bots at the same time.

The approval command is used to allow a user to message the bot under the pairing policy:

openclaw pairing approve telegram <TOKEN_GENERATED_BY_BOT_TYPE_START>

Once approved, that user can continue to DM the bot normally, and future messages will be processed without repeating the approval step for that pairing entry.

Avoiding Double Replies with Two Bots

When both bots are in the same group, they can both receive the same group messages. If both are routed to the same agent, you might see duplicate replies. The usual solution is to route based on accountId, so each bot goes to a different agent or uses different rules. This is done in your bindings or routing layer by matching on the Telegram account identifier you chose, such as default and botB.


----

OpenClaw and the lobster logo are trademarks of their respective owners. This blog is an independent guide and is not affiliated with or endorsed by the OpenClaw project. 

No comments:

Post a Comment