back to docs
ai

Telegram Bot Setup

Connect OpenClaw to Telegram and chat with your agent from anywhere

Connecting OpenClaw to Telegram lets you interact with your agent from your phone or any device with Telegram. Once connected, just message the bot and the agent responds.

1. Create a Telegram bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot
  3. Follow the prompts, choose a name and username for your bot
  4. BotFather will give you a bot token like 1234567890:ABCDEFghijklmnopqrstuvwxyz

Copy this token, you’ll need it in the next step.

2. Add Telegram channel to OpenClaw

openclaw channels add telegram

When prompted, paste your bot token.

Alternatively, add it directly to ~/.openclaw/openclaw.json:

{
  "channels": {
    "telegram": {
      "enabled": true,
      "token": "1234567890:ABCDEFghijklmnopqrstuvwxyz"
    }
  }
}

3. Restart the gateway

openclaw gateway restart

4. Test the connection

Open Telegram, find your bot by its username, and send a message:

Hello, are you there?

The agent should respond. If it doesn’t, check gateway logs:

openclaw gateway logs

By default, anyone who finds your bot can message it. To restrict access to yourself only, add your Telegram user ID to the allowlist.

First, find your user ID: message @userinfobot on Telegram and it will reply with your numeric ID.

Then update openclaw.json:

{
  "channels": {
    "telegram": {
      "enabled": true,
      "token": "1234567890:ABCDEFghijklmnopqrstuvwxyz",
      "allowlist": ["123456789"]
    }
  }
}

Restart the gateway after saving.

Keep your bot token private

Anyone with your bot token can impersonate your bot. Never share it publicly or commit it to version control.

6. Useful chat commands

Once connected, these slash commands work inside the Telegram chat:

CommandWhat it does
/newStart a new session
/resetReset the current session
/compactCompress context to free space
/stopStop the current task
/statusShow agent status
/contextShow current session context size

Troubleshooting

Bot doesn’t respond: Check openclaw gateway status and openclaw gateway logs for errors.

Token invalid error: Make sure you copied the full token from BotFather without extra spaces.

Gateway not running: Run openclaw gateway start or check if the daemon is enabled with openclaw gateway status.

Command Palette
Search for a command to run...