OpenClaw
Purpose
This guide explains how to temporarily disable Telegram direct message pairing in OpenClaw so nobody can talk to your bot in private chat.
It also explains how to enable pairing again later when you want to allow a new account to connect.
OpenClaw supports several DM access modes for Telegram, including pairing and disabled. The default mode is pairing.
Why this matters
If your bot is in pairing mode, unknown users can still send a message and receive a pairing code. They cannot fully talk to the bot until you approve them, but they can still trigger the pairing flow.
If you want the strictest temporary lock, use disabled. In this mode, the bot ignores inbound direct messages. This is the safest option when you are not ready for anyone to chat with the bot.
Before you change anything
Make a backup of your OpenClaw config first.
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak.$(date +%Y%m%d-%H%M%S)
This gives you a rollback point if you want to restore your previous settings.
Part 1: Disable Telegram DM pairing
For example: you have two Telegram account slots, default and us-phone-number.
It is a good idea to set both the global Telegram DM policy and each account level DM policy, so there is no confusion about which value is active in a multi account setup. OpenClaw applies base channel settings to accounts unless you override them per account.
Run these commands:
openclaw config set channels.telegram.dmPolicy disabled
openclaw config set channels.telegram.accounts.default.dmPolicy disabled
openclaw config set channels.telegram.accounts.us-phone-number.dmPolicy disabled
openclaw gateway restart
Part 2: Verify the change
After restarting the gateway, check all three values.
openclaw config get channels.telegram.dmPolicy
openclaw config get channels.telegram.accounts.default.dmPolicy
openclaw config get channels.telegram.accounts.us-phone-number.dmPolicy
Each command should return:
disabled
If all three show disabled, your Telegram private chat access is locked.
Part 3: Enable pairing again later
When you want to allow a new account to talk to the bot again, switch the DM policy back to pairing.
Run:
openclaw config set channels.telegram.dmPolicy pairing
openclaw config set channels.telegram.accounts.default.dmPolicy pairing
openclaw config set channels.telegram.accounts.us-phone-number.dmPolicy pairing
openclaw gateway restart
After that, new users can trigger the pairing flow again. Pairing codes are temporary and expire after one hour.
Part 4: Verify pairing is enabled
Use the same check commands:
openclaw config get channels.telegram.dmPolicy
openclaw config get channels.telegram.accounts.default.dmPolicy
openclaw config get channels.telegram.accounts.us-phone-number.dmPolicy
Each one should return:
pairing
Notes for future maintenance
If you add more Telegram accounts later, repeat the account level dmPolicy setting for each new account.
If your account IDs are different from default or us-phone-number, replace those names with your real account IDs.
If you want a middle option in the future, OpenClaw also supports allowlist, which only allows specific Telegram user IDs. This can be useful when you want strict access without completely disabling DMs.
----
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