Skip to main content

Overview

Deploy an AI-powered Telegram bot using OpenClaw and FoxAPI. This integration allows you to chat with AI models directly in Telegram conversations.
This guide assumes you have already completed the basic OpenClaw Manual Installation. If not, please set up OpenClaw first.

Prerequisites

FoxAPI API Key

An active FoxAPI API key.

OpenClaw Instance

A running OpenClaw instance (see Manual Installation).

Telegram Account

A Telegram account to create a bot via BotFather.

Configuration

1

Create a Telegram Bot

  1. Open Telegram and visit @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
2

Run Onboarding with Telegram Channel

If you haven’t already onboarded OpenClaw, run the onboarding wizard and select Telegram as your channel:
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:
{
  "channels": {
    "telegram": {
      "enabled": true,
      "botToken": "your-telegram-bot-token",
      "dmPolicy": "pairing",
      "groups": {
        "*": {
          "requireMention": true
        }
      }
    }
  }
}
3

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:
openclaw pairing approve telegram <pairing-code>
4

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 FoxAPI.
In group chats, the bot requires an @mention by default. You can change this behavior in the groups configuration.

Bot Usage

ActionHow
Chat in DMSend any message directly to the bot
Chat in Group@mention the bot in a group chat
Switch ModelConfigured 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 FoxAPI.

Troubleshooting

  • Check that the bot token in openclaw.json is correct.
  • Verify the OpenClaw daemon is running: openclaw status
  • Ensure your FoxAPI API key is valid and has balance.
  • Check logs for errors.
  • Make sure the Telegram channel is enabled in openclaw.json.
  • Restart the OpenClaw daemon after config changes.
  • Try sending /start to the bot first.
  • 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.