NEW 📢 Limited launch offer: up to 70% off your first month on every game!See plans

How to connect OpenClaw to Telegram

OpenClawUpdated Nov 6, 20267 min read

Short answer. Create a bot with @BotFather in Telegram (/newbot) and copy its token. Give the token to OpenClaw, then allow only your own numeric Telegram user ID to message it. On your own machine that is openclaw channels add --channel telegram --token <token> plus dmPolicy: "allowlist" with your ID in allowFrom. On PlayNHost you paste the token and your ID on the Agent page and restart.

Checked on 6 November 2026, accurate for OpenClaw 2026.11.1.

This guide uses OpenClaw's Telegram documentation and the PlayNHost panel as it works today. Telegram is built into OpenClaw: there is no plugin to install.

Step 1: create the bot and copy its token

  1. In Telegram, open a chat with @BotFather. Check that the handle is exactly @BotFather.
  2. Send /newbot, choose a display name, then a username that ends in bot.
  3. BotFather replies with the token, which looks like 123456789:AAH.... Keep it private: anyone with it can control your bot.

BotFather also has a web app (t.me/BotFather?startapp) that does the same thing with buttons.

Use a bot that nothing else runs. If an older OpenClaw on your laptop, or any other program, still uses the same token, stop it first or create a new bot.

Step 2: find your Telegram user ID

OpenClaw's allowlist takes your numeric user ID, not your @username, phone number or the bot's ID. The ways OpenClaw's docs list:

  • From the bot itself (no third party). While the bot is in pairing mode, send it any message. Its pairing reply includes "Your Telegram user id". On PlayNHost this is the way we suggest, see below.
  • From OpenClaw's log. Run openclaw logs --follow, message the bot and read senderUserId in the telegram pairing request entry.
  • Telegram's own API. Message the bot, then open https://api.telegram.org/bot<bot_token>/getUpdates and read message.from.id.
  • A third-party bot such as @userinfobot or @getidsbot. OpenClaw's docs call this less private.

Step 3 on PlayNHost: paste the token and your ID

You need an AI provider key on the same page. Without one, Start stops with "Your agent is not set up yet: it needs an API key from one AI provider and a Telegram or Discord bot token."

  1. Open your server at panel.playnhost.com, then the Agent tab.
  2. Under AI provider, set one key if you have not yet (see which AI provider key to use).
  3. Under Chat apps, press Set on Telegram bot token, paste the token from BotFather and press Save. The panel checks its shape; a wrong paste gets "That is not a valid telegram bot token." Once saved, the row shows only the last four characters, and the token is never shown again.
  4. Don't know your ID yet? Leave Telegram user IDs empty and press Start. When the agent is up, the console prints:
    [PlayNHost] Your agent is running
    [PlayNHost] Telegram: nobody can message your agent yet. Send your bot any message: it answers with your Telegram user ID. Copy that ID, put it on the Agent page, then restart. Ignore the pairing code in its reply.
    Send your bot a message in Telegram. It answers once with a pairing code and your Telegram user ID (OpenClaw sends a code about once an hour per person and ignores the messages in between). Copy the ID and ignore the code: nothing needs approving on PlayNHost. Nobody is let in by this step.
  5. Under Who can message it, type your ID into Telegram user IDs and press Save. Several IDs go on one line, separated by commas.
  6. The page says "Changes apply the next time your agent starts." Press Restart now. The console then confirms:
    [PlayNHost] Telegram: only user 123456789 can message your agent.
  7. Message your bot. Your agent answers. Messages from any other Telegram account are ignored.

What PlayNHost sets for you

  • With IDs on the Agent page, Telegram DMs use dmPolicy: "allowlist" with exactly those IDs, which is what OpenClaw's docs recommend for a bot with one owner. With no ID, they use pairing: strangers get a code and are ignored, and nobody can approve them without OpenClaw's command line or dashboard, and a PlayNHost server offers neither.
  • The IDs you list also become OpenClaw's command owners (commands.ownerAllowFrom), so owner-only commands work for you from the first message.
  • The token reaches OpenClaw as TELEGRAM_BOT_TOKEN in its environment. A token written into OpenClaw's own settings file would win over that, so the start removes it from the file: the token on the Agent page is the one used.
  • Groups stay closed: OpenClaw admits no group until one is added to its settings, and a setting that lets anyone talk to the agent is switched back to your IDs at the next start.

Step 3 on your own machine

  1. Add the token:
    openclaw channels add --channel telegram --token <bot-token>
    or set TELEGRAM_BOT_TOKEN in the Gateway's environment. A token in the config file wins over the environment variable.
  2. Allow only yourself in ~/.openclaw/openclaw.json:
    {
      channels: {
        telegram: {
          enabled: true,
          dmPolicy: "allowlist",
          allowFrom: ["123456789"],
        },
      },
      commands: {
        ownerAllowFrom: ["telegram:123456789"],
      },
    }
    The commands part makes you the owner for owner-only commands: OpenClaw does not do that for a hand-written allowlist. An allowlist with an empty allowFrom blocks every DM and is rejected by OpenClaw's config check.
  3. Or keep the default pairing mode and approve yourself after your first message:
    openclaw pairing list telegram
    openclaw pairing approve telegram <CODE>
    Codes expire after one hour. The first approved pairing also makes you the command owner.
  4. Check the channel with openclaw channels status --probe.

When it does not answer

What you seeCause and fix
Console: "Telegram: nobody can message your agent yet"No ID is on the Agent page. Add yours and restart.
The bot replied once with a pairing code, then nothingThe Telegram user IDs list is empty, so the agent is in pairing mode. Put the number from the pairing reply on the Agent page and restart.
The bot ignores you and sends no codeAn ID is on the list but it is not yours (for example the bot's ID or a group ID). To see your ID again, empty the list, restart and message the bot: the pairing reply shows it.
Console: "...entry in the allowed users list is not a Telegram user ID and was ignored"A number in the list is too short or too long to be a Telegram user ID (PlayNHost accepts 5 to 20 digits). Check it against the pairing reply and restart.
getMe returned 401 in OpenClaw's logTelegram refused the token: it was revoked or mistyped. In @BotFather, send /mybots, choose your bot, then API Token, copy it again and press Replace on the Agent page. On PlayNHost, OpenClaw's log is logs/openclaw.log in Files.
Nothing in a groupGroups are closed by default. Talk to the agent in a direct message.

Want Discord as well? See connect OpenClaw to Discord. Not set up yet? Create an OpenClaw server.

PlayNHost is not affiliated with the OpenClaw Foundation. OpenClaw is open-source software under the MIT licence.

Already hosting it somewhere else? Move your server to us

OUR LATEST BLOGS