Skip to content

Telegram Configuration

Status: Production-Ready (Bot API via grammY).

OpenClaw integrates seamlessly with Telegram bots, allowing you to interact with your agent via DMs or add it to group chats.

  1. Create a Bot

    • Open Telegram and search for @BotFather.
    • Send /newbot and follow the prompts.
    • Copy the HTTP API Token provided (e.g., 123456789:ABCdefGHIjklMNOpqrstUVwxyz).
  2. Configure OpenClaw Add the token to ~/.openclaw/openclaw.json:

    {
    channels: {
    telegram: {
    enabled: true,
    botToken: "YOUR_BOT_TOKEN_HERE",
    dmPolicy: "pairing" // Requires pairing code on first contact
    }
    }
    }
  3. Start the Gateway

    Terminal window
    openclaw gateway run
  4. Pairing

    • Send a message to your new bot on Telegram (e.g., “Hello”).
    • The bot will reply asking for a pairing code.
    • Check the gateway logs for the code and send it to the bot.

Control who can talk to your bot in Direct Messages.

PolicyDescription
pairing (Default)New users must enter a one-time code printed in the gateway logs.
allowlistOnly users in allowFrom (list of user IDs) can interact.
openAnyone can talk to the bot (Not recommended for public bots).

To use the bot in groups:

  1. Privacy Mode: By default, bots only see messages mentioning them or replies.

    • To see all messages: Talk to @BotFather, use /setprivacy -> Disable.
    • Note: OpenClaw usually works best when it can see context.
  2. Group Config:

    {
    channels: {
    telegram: {
    // ...
    groups: {
    "*": { requireMention: true } // Only reply when @mentioned
    }
    }
    }
    }

You can designate certain Telegram users as Admins. Admins can:

  • Run sensitive tools (if configured).
  • Bypass certain policy checks.
{
channels: {
telegram: {
adminUsers: [123456789] // Your numeric Telegram User ID
}
}
}