🦞OpenClaw Guide
← Back to BlogGuide

OpenClaw Telegram Allowlist: How to Make Your Bot Ignore Everyone Except You

2026-03-175 min read

OpenClaw Telegram Allowlist: How to Make Your Bot Ignore Everyone Except You

If your OpenClaw bot is connected to Telegram without an allowlist, anyone who knows your bot's handle can try to send it commands. They could ask it to list your files, run commands, read your calendar, or do anything else your agent is configured to do.

The allowlist makes this completely irrelevant. Set it up and everyone except your specific Telegram user IDs gets complete silence — no error message, no acknowledgment, nothing.


The Actual Threat

Telegram bots are publicly searchable. If someone finds your bot (through the handle, through search, or because you mentioned it somewhere), they can send it messages. Without an allowlist, your bot will respond to everyone.

The attack doesn't require sophisticated hacking. Someone messages your bot: "List the contents of ~/." If your bot has file system access and no allowlist, it responds. That's it.

The allowlist eliminates this entirely. Unauthorized users don't get an error response that confirms the bot exists. They get silence — which gives an attacker no useful information.


Step 1: Find Your Telegram User ID

Your Telegram user ID is a numeric identifier (like 123456789). It's different from your username (@yourhandle).

To get it:

  1. Open Telegram
  2. Search for @userinfobot
  3. Start a chat and send /start
  4. The bot replies with your user information, including your numeric user ID

Copy that number. You'll need it for the config.

If you want to add multiple users to the allowlist (a trusted family member, a second device logged in under a different account), repeat this for each user.


Step 2: Add the Allowlist to openclaw.json

Edit ~/.openclaw/openclaw.json:

{
  "channels": {
    "telegram": {
      "dmPolicy": "pairing",
      "groupPolicy": "disabled",
      "allowFrom": ["tg:YOUR_USER_ID_HERE"]
    }
  }
}

Replace YOUR_USER_ID_HERE with the numeric ID from @userinfobot. Keep the tg: prefix.

Restart OpenClaw after editing:

openclaw gateway restart

What the Config Fields Do

allowFrom: ["tg:123456789"]

Restricts bot responses to specific Telegram user IDs. Anyone not in this list sends a message — nothing happens. No response, no error, no acknowledgment. From their perspective, the bot doesn't exist.

For multiple authorized users:

"allowFrom": ["tg:123456789", "tg:987654321"]

dmPolicy: "pairing"

Controls how the bot handles direct messages. "pairing" means the bot will only respond to DMs from users who have explicitly paired their account. For personal use, this combined with allowFrom means only your explicitly authorized accounts can interact with the bot.

Available values:

  • "pairing" — requires pairing (most secure for personal use)
  • "open" — responds to any DM (don't use without allowFrom)

groupPolicy: "disabled"

Completely disables group chat functionality. The bot won't respond to any messages in group chats.

This is critical. Without this setting, anyone who adds your bot to a group chat — or who is already in a group your bot is in — can send it commands. With "disabled", group messages are completely ignored regardless of who sends them.

[→ See also: OpenClaw Group Chat Security: Why Your Bot Should Never Be in a Group]


What Happens to Unauthorized Users

Nothing. That's the point.

An unauthorized user messages your bot:

  • They receive no reply
  • The message is silently dropped
  • No error message confirms the bot is running
  • No "permission denied" response reveals the bot exists

From an attacker's perspective, this is indistinguishable from a bot that's offline or doesn't exist. They can't enumerate your bot's capabilities, confirm it's running, or probe for weaknesses because they receive zero feedback.


Gateway Password as a Second Layer

The Telegram allowlist controls who can message the bot through Telegram. The gateway password controls who can access the web dashboard. These are separate authentication layers.

Ensure your gateway is also configured with a strong password:

{
  "gateway": {
    "auth": {
      "mode": "password",
      "password": "YOUR-STRONG-30-CHAR-PASSWORD-HERE"
    }
  }
}

[→ See also: OpenClaw Gateway Token Security: The Master Key You're Probably Mishandling]


Multi-User Setups

If you're setting up OpenClaw for more than one person (a household, a small team), you have two options:

Option 1: Add all user IDs to the allowlist

"allowFrom": ["tg:USER1_ID", "tg:USER2_ID", "tg:USER3_ID"]

All listed users can give the bot commands. All users share the same agent context (same files, same memory, same capabilities). Simple, but no permission separation between users.

Option 2: Run separate instances

Each user gets their own OpenClaw instance with their own allowlist, their own agent context, and potentially different permission levels. More setup, but proper separation.

For anything beyond a small household, separate instances are the right architecture. You don't want a family member accidentally triggering a command that reads business files, or vice versa.


The Complete Telegram Security Config

{
  "gateway": {
    "auth": {
      "mode": "password",
      "password": "YOUR-STRONG-30-CHAR-PASSWORD-HERE",
      "allowTailscale": true
    }
  },
  "channels": {
    "telegram": {
      "dmPolicy": "pairing",
      "groupPolicy": "disabled",
      "allowFrom": ["tg:YOUR_TELEGRAM_USER_ID"]
    }
  }
}

Verifying the Allowlist Works

After applying the config:

  1. Send a message to your bot from your Telegram account — it should respond normally
  2. Ask a friend or use a second Telegram account (not in the allowlist) to message the bot — they should receive complete silence
  3. Try adding your bot to a group chat — it should not respond to any messages

If the bot responds to unauthorized users, check:

  • The config was saved correctly
  • The gateway was restarted (openclaw gateway restart)
  • The user ID format is correct (tg:NUMBERS, not @username)

Key Takeaways

  • Without an allowlist, anyone who finds your bot handle can send it commands — no authentication required
  • Get your Telegram user ID from @userinfobot (it's a number, not your username)
  • Use allowFrom: ["tg:YOUR_ID"] in the telegram channel config; unauthorized users get complete silence
  • dmPolicy: "pairing" restricts DMs; groupPolicy: "disabled" kills group chat entirely — use both
  • For multiple authorized users, add all IDs to the allowFrom array
  • For multi-user deployments with different permission levels, run separate OpenClaw instances with separate allowlists

Learn alongside 1,000+ operators

Ask questions, share workflows, and get help from people running OpenClaw every day.