guide

How to Deploy a Telegram Bot with OpenClaw

Create an AI-powered Telegram bot with OpenClaw. Complete guide covering BotFather setup, token configuration, and advanced features like inline buttons.

This guide walks you through creating an AI-powered Telegram bot using OpenClaw. You'll create a bot via BotFather, configure it in OpenClaw, and enable advanced features like inline buttons and group support.

Step 1: Create a Bot with BotFather

1

Open Telegram and search for @BotFather

BotFather is Telegram's official bot for creating bots.

2

Send /newbot command

Start the bot creation flow.

3

Choose a name for your bot

This is the display name users will see (e.g., 'My AI Assistant').

4

Choose a username

Must be unique and end in 'bot' (e.g., 'myai_helper_bot').

5

Save your bot token

BotFather will give you a token like '123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11'. Keep this secret!

Step 2: Configure OpenClaw

Add your bot token to OpenClaw. You can use an environment variable or config file:

bash
# Via environment variable
export TELEGRAM_BOT_TOKEN=your_token_here

Or in your ~/.openclaw/openclaw.json:

json
{
  "channels": {
    "telegram": {
      "enabled": true,
      "botToken": "123456789:ABC-DEF1234...",
      "dmPolicy": "pairing"
    }
  }
}

Step 3: Configure Privacy Settings

For group support, configure privacy mode in BotFather. Send these commands to @BotFather:

text
/setprivacy → Select your bot → Disable
/setjoingroups → Select your bot → Enable
💡When you toggle privacy mode, Telegram requires removing and re-adding the bot to each existing group for changes to take effect.

Step 4: Enable Advanced Features

Inline Buttons

json
{
  "channels": {
    "telegram": {
      "capabilities": {
        "inlineButtons": "all"
      }
    }
  }
}

Custom Commands

json
{
  "channels": {
    "telegram": {
      "customCommands": [
        { "command": "help", "description": "Show help message" },
        { "command": "status", "description": "Check bot status" }
      ]
    }
  }
}

Group Configuration

json
{
  "channels": {
    "telegram": {
      "groups": {
        "*": { "requireMention": false }
      }
    }
  }
}

Step 5: Start and Test

Restart your gateway and test the bot:

bash
# Restart gateway
openclaw gateway restart

# Check logs
openclaw logs --follow

Send a message to your bot on Telegram. If using pairing mode, approve the request:

bash
openclaw pairing list telegram
openclaw pairing approve telegram <code>
Your Telegram bot is live! It will now respond to messages using your AI agent.

Deploy a Telegram bot instantly

No BotFather setup, no token management. Deploy an AI Telegram bot in 1 click.

Deploy Telegram Bot →
How to Deploy a Telegram Bot with OpenClaw (2025) | clawd.new