> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aihubmax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenClaw + Telegram

> Deploy an OpenClaw bot on Telegram with AihubMax

## Overview

Deploy an AI-powered Telegram bot using OpenClaw and AihubMax. This integration allows you to chat with AI models directly in Telegram conversations.

<Info>
  This guide assumes you have already completed the basic [OpenClaw Manual Installation](/en/integration-guide/openclaw). If not, please set up OpenClaw first.
</Info>

## Prerequisites

<CardGroup cols={2}>
  <Card title="AihubMax API Key" icon="key">
    An active AihubMax API key.
  </Card>

  <Card title="OpenClaw Instance" icon="server">
    A running OpenClaw instance (see [Manual Installation](/en/integration-guide/openclaw)).
  </Card>

  <Card title="Telegram Account" icon="paper-plane">
    A Telegram account to create a bot via BotFather.
  </Card>
</CardGroup>

## Configuration

<Steps>
  <Step title="Create a Telegram Bot">
    1. Open Telegram and visit [@BotFather](https://t.me/BotFather).
    2. Send `/start`, then `/newbot`.
    3. Set a username for your bot (must end with `bot`, e.g., `my_foxapi_bot`).
    4. BotFather will provide a **Bot Token** -- save it for the next step.

    ```
    Example token format: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
    ```
  </Step>

  <Step title="Run Onboarding with Telegram Channel">
    If you haven't already onboarded OpenClaw, run the onboarding wizard and select Telegram as your channel:

    ```bash theme={null}
    openclaw onboard --install-daemon
    ```

    When prompted, select **"Telegram (Bot API)"** and paste your Bot Token.

    If you have already onboarded, you can manually add the Telegram configuration to `~/.openclaw/openclaw.json`:

    ```json theme={null}
    {
      "channels": {
        "telegram": {
          "enabled": true,
          "botToken": "your-telegram-bot-token",
          "dmPolicy": "pairing",
          "groups": {
            "*": {
              "requireMention": true
            }
          }
        }
      }
    }
    ```
  </Step>

  <Step title="Pair Your Telegram Account">
    After configuring the Telegram channel, you need to pair your Telegram account. Start a conversation with your bot in Telegram and you'll receive a pairing code.

    Then run:

    ```bash theme={null}
    openclaw pairing approve telegram <pairing-code>
    ```
  </Step>

  <Step title="Test Your Bot">
    1. Open Telegram and search for your bot by its username.
    2. Send a test message like **"Hello!"**
    3. The bot should respond using the configured AI model through AihubMax.

    <Note>
      In group chats, the bot requires an `@mention` by default. You can change this behavior in the `groups` configuration.
    </Note>
  </Step>
</Steps>

## Bot Usage

| Action        | How                                                |
| ------------- | -------------------------------------------------- |
| Chat in DM    | Send any message directly to the bot               |
| Chat in Group | @mention the bot in a group chat                   |
| Switch Model  | Configured via `openclaw model switch` CLI command |

## Verify the Connection

Send a message to your Telegram bot:

```
Who are you? What model are you using?
```

The bot should reply with a response generated by the AI model configured through AihubMax.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Bot does not respond to messages">
    * Check that the bot token in `openclaw.json` is correct.
    * Verify the OpenClaw daemon is running: `openclaw status`
    * Ensure your AihubMax API key is valid and has balance.
    * Check logs for errors.
  </Accordion>

  <Accordion title="Pairing code not received">
    * Make sure the Telegram channel is enabled in `openclaw.json`.
    * Restart the OpenClaw daemon after config changes.
    * Try sending `/start` to the bot first.
  </Accordion>

  <Accordion title="Bot works in DM but not in groups">
    * In groups, the bot requires `@mention` by default.
    * You can set `"requireMention": false` in the groups config to allow free-form responses.
    * Make sure the bot has been added to the group as a member.
  </Accordion>
</AccordionGroup>
