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
Create a Telegram Bot
- Open Telegram and visit @BotFather.
- Send
/start, then/newbot. - Set a username for your bot (must end with
bot, e.g.,my_foxapi_bot). - BotFather will provide a Bot Token — save it for the next step.
Run Onboarding with Telegram Channel
If you haven’t already onboarded OpenClaw, run the onboarding wizard and select Telegram as your channel: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: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:
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:Troubleshooting
Bot does not respond to messages
Bot does not respond to messages
- Check that the bot token in
openclaw.jsonis correct. - Verify the OpenClaw daemon is running:
openclaw status - Ensure your FoxAPI API key is valid and has balance.
- Check logs for errors.
Pairing code not received
Pairing code not received
- Make sure the Telegram channel is enabled in
openclaw.json. - Restart the OpenClaw daemon after config changes.
- Try sending
/startto the bot first.
Bot works in DM but not in groups
Bot works in DM but not in groups
- In groups, the bot requires
@mentionby default. - You can set
"requireMention": falsein the groups config to allow free-form responses. - Make sure the bot has been added to the group as a member.