Telegram is one of the most popular platforms for AI bots. With over 800 million active users, it offers a simple, secure, and feature-rich environment for deploying your OpenClaw AI agent. If you're also considering other platforms, check out our guides for Discord and WhatsApp.
In this guide, you'll learn how to connect OpenClaw to Telegram step-by-step. By the end, you'll have a fully functional AI bot that can respond to messages, handle commands, and interact with users in real-time.
What You'll Need
- A Telegram account (free)
- An OpenClaw agent set up on Ampere.sh
- About 10 minutes of your time
Step 1: Create a Telegram Bot with @BotFather
BotFather is Telegram's official bot for creating and managing bots. Here's how to use it:
- Open Telegram and search for
@BotFatherin the search bar - Start a conversation with BotFather by clicking the Start button
- Type
/newbotand send the message - BotFather will ask for a name for your bot (this is the display name)
- Next, provide a username for your bot (must end in 'bot', e.g., MyOpenClawBot)
Tip: Choose a descriptive name that reflects your bot's purpose. The username must be unique across all of Telegram.
Step 2: Get Your API Token
Once you've created your bot, BotFather will send you a message with your HTTP API token. It looks like this:
123456789:ABCdefGHIjklMNOpqrSTUvwxyzABCdefGHIImportant: This token is like a password for your bot. Keep it secure and never share it publicly. Anyone with this token can control your bot.
Copy this token and save it somewhere safe. You'll need it in the next step.
Step 3: Configure OpenClaw on Ampere
Now let's connect your Telegram bot to your OpenClaw agent:
- Log in to your Ampere dashboard
- Navigate to your agent's settings
- Click on the "Integrations" tab
- Find Telegram in the list of available integrations
- Click "Connect"
- Paste your Telegram API token from Step 2
- Click "Save"
Step 4: Set Up Webhook (Optional but Recommended)
For production deployments, you should configure a webhook instead of polling. This ensures faster message delivery and better performance.
Ampere automatically handles webhook configuration for you. Once you've connected your token in Step 3, your webhook URL is automatically generated and registered with Telegram.
Webhook URL Format:
https://api.ampere.sh/webhooks/telegram/{your-agent-id}
Step 5: Test Your Bot
Your bot should now be live! Let's test it:
- Open Telegram and search for your bot by its username
- Click Start or send the
/startcommand - Your OpenClaw agent should respond with a welcome message
- Try sending a few messages to see how your agent responds
If your bot doesn't respond immediately, wait a few seconds for the connection to fully establish, then try again.
Step 6: Customize Your Bot
Now that your bot is working, let's customize it:
Set a Profile Picture
- Go back to @BotFather
- Type
/setuserpic - Select your bot from the list
- Upload an image
Set a Description
- In @BotFather, type
/setdescription - Select your bot
- Enter a description (up to 512 characters)
Set Commands
You can define commands that users can see in the bot menu:
- Type
/setcommandsin @BotFather - Select your bot
- Enter commands in this format:
start - Start the conversation
help - Get help and instructions
status - Check agent status
reset - Reset conversationTroubleshooting
Bot Not Responding?
- Verify your API token is correct
- Check that your OpenClaw agent is running on Ampere
- Look at the logs in your Ampere dashboard for errors
- Try revoking and regenerating your token in @BotFather
Bot Responding Slowly?
- Ensure you're using webhook mode, not polling
- Check your agent's response time in Ampere
- Review our memory optimization guide for performance tips
Bot Not Receiving Group Messages?
- In @BotFather, go to
/setprivacy - Select your bot
- Set it to Disable (allows bot to read all group messages)
Frequently Asked Questions
Is the Telegram Bot API free?
Can I use my bot in group chats?
How do I keep my bot token secure?
Can I run multiple bots with OpenClaw?
What commands can I use with my bot?
Final Thoughts
You've successfully connected your OpenClaw AI agent to Telegram! Your bot is now ready to interact with users, answer questions, and perform tasks on one of the world's most popular messaging platforms.
From here, you can continue to enhance your bot by adding more skills to your OpenClaw agent, configuring custom commands, setting up group chat functionality, and integrating with other platforms simultaneously.
Ready to Deploy Your Telegram Bot?
Get started with Ampere and connect your OpenClaw agent to Telegram in minutes.
Get Started →