How to Connect a Telegram Bot to Your AI Agent
Telegram is one of the most popular ways to interact with your OpenClaw AI agent. Instead of accessing your agent through a web interface or API calls, you can simply open Telegram on your phone or desktop and chat with your agent like you would with any other contact.
This guide walks you through the entire process: creating a Telegram bot, obtaining your bot token, connecting it to your EZClaws agent, and testing the integration. By the end, you will have a fully functional AI assistant living inside Telegram that you can message anytime, anywhere.
Prerequisites
Before you begin, make sure you have:
- An EZClaws account — Sign up at ezclaws.com if you have not already.
- A deployed OpenClaw agent — You need a running agent to connect the bot to. If you have not deployed one yet, follow our deployment guide first.
- A Telegram account — Download Telegram from telegram.org if you do not have it installed. Available on iOS, Android, desktop, and web.
No coding or command-line experience is required for this guide.
Step 1: Open Telegram and Find BotFather
BotFather is Telegram's official bot for creating and managing other bots. It is the starting point for any Telegram bot integration.
Open Telegram and search for @BotFather in the search bar. Make sure you select the official BotFather account — it has a blue verification checkmark next to its name.
Alternatively, you can navigate directly to https://t.me/BotFather in your browser, which will open the chat in Telegram.
Once you have BotFather open, you are ready to create your bot.
Step 2: Create a New Bot with BotFather
Start a conversation with BotFather by clicking the Start button or typing /start. BotFather will respond with a list of available commands.
To create a new bot, send the following command:
/newbot
BotFather will ask you two questions:
-
What name do you want for your bot? — This is the display name that users will see. Choose something descriptive like "My AI Assistant" or "Support Bot by EZClaws". This can contain spaces and does not need to be unique.
-
What username do you want for your bot? — This must be unique across all of Telegram and must end with "bot". For example:
my_ai_assistant_botorezclaws_support_bot. If your chosen username is taken, try adding numbers or underscores.
# Example conversation with BotFather:
You: /newbot
BotFather: Alright, a new bot. How are we going to call it?
You: My AI Assistant
BotFather: Good. Now let's choose a username for your bot.
You: my_ai_assistant_bot
BotFather: Done! Congratulations on your new bot...
Step 3: Copy Your Bot Token
After creating the bot, BotFather will respond with a message that includes your HTTP API token. It looks something like this:
7123456789:AAHfiqksKZ8WmR2zYnTcBQHhJ5gLpUdRxCw
This token is essentially the password for your bot. Anyone with this token can control your bot, so treat it like a secret. Do the following:
- Copy the token — Select and copy the entire token string.
- Do not share it publicly — Never post your bot token in public repositories, forums, or social media.
- Store it safely — If you need to reference it later, keep it in a secure password manager.
If you accidentally expose your token, you can revoke it by sending /revoke to BotFather and generating a new one.
Step 4: Configure Your EZClaws Agent
Now that you have a bot token, you need to connect it to your EZClaws agent. Log in to your EZClaws dashboard and navigate to your agent.
For a New Agent
If you are deploying a new agent, you will see a Telegram Bot Token field in the agent creation form. Paste your token there before clicking Deploy Agent.
For an Existing Agent
If you already have a running agent and want to add Telegram:
- Go to your dashboard at
/app. - Click on the agent you want to connect.
- Open the agent's settings or configuration panel.
- Find the Telegram Bot Token field.
- Paste your bot token.
- Save the changes.
The agent will automatically configure itself to listen for Telegram messages using the provided token. This typically takes 10 to 30 seconds.
# Your bot token will look like this — paste the entire string:
7123456789:AAHfiqksKZ8WmR2zYnTcBQHhJ5gLpUdRxCw
Step 5: Test the Connection
Open Telegram and search for your bot by its username (the one ending in "bot" that you chose in Step 2). Open the chat and click Start or send any message.
Try sending a simple greeting:
Hello! What can you do?
Your OpenClaw agent should respond within a few seconds. The response will come from your agent's configured LLM, processed through the OpenClaw framework, and delivered back through Telegram.
If the bot responds, the integration is working. If not, check the troubleshooting section below.
Step 6: Customize Your Bot's Profile
While not required, customizing your bot's Telegram profile makes it look more professional. Send these commands to BotFather:
Set a Description
The description appears when users first open your bot before clicking Start:
/setdescription
Then select your bot and type a description like: "I'm an AI assistant powered by OpenClaw and hosted on EZClaws. I can help you with research, writing, code, and more."
Set an About Text
The about text appears in the bot's profile:
/setabouttext
Set a Profile Picture
/setuserpic
BotFather will ask you to upload an image. Use a square image (at least 512x512 pixels) for the best results.
Set Bot Commands
You can define a command menu that appears when users type / in the chat:
/setcommands
Then provide commands in the format:
help - Show what I can do
reset - Start a new conversation
status - Check if I'm online
Step 7: Share Your Bot
Once everything is working, you can share your bot with others. There are several ways to do this:
- Direct link — Share
https://t.me/your_bot_usernamewith anyone. - QR code — Generate a QR code from the link for physical materials.
- Telegram search — Others can find your bot by searching its username.
- Inline mentions — In any Telegram chat, type
@your_bot_usernameto mention it.
Remember that all conversations with your bot consume credits from your EZClaws account. If you are sharing the bot publicly, monitor your usage carefully at /app/billing to avoid unexpected charges. For more on managing costs, see our guide on reducing AI agent costs.
Troubleshooting
Bot does not respond to messages
If your bot is not responding:
- Check agent status — Verify your agent shows "Running" on the EZClaws dashboard at
/app. - Verify the token — Make sure you pasted the complete bot token with no extra spaces or characters.
- Check credits — If your credits are exhausted, the agent will not process messages. Visit
/app/billingto check. - Wait and retry — After saving the token, wait 30 seconds for the connection to establish, then try again.
- Review event log — Check the agent's event log on its detail page for any error messages.
Bot responds slowly
Slow responses can have several causes:
- Model provider latency — Larger models like GPT-4o take longer to generate responses than smaller models. Consider switching to a faster model if response time is critical.
- Agent region — If your Telegram users are far from your agent's deployment region, there may be additional latency. Choose a region closer to your users.
- Complex queries — Queries that require the agent to browse the web, execute code, or use multiple tools will naturally take longer than simple conversational responses.
Bot sends error messages
If the bot responds with error messages:
- API key issues — Your model provider API key may have expired or hit its rate limit. Check your provider's dashboard and update the key in EZClaws if needed. See our API key management guide.
- Credit exhaustion — If you have run out of credits, the agent cannot make API calls. Purchase additional credits at
/app/billing.
BotFather says the username is taken
Bot usernames must be unique across all of Telegram. Try variations like:
- Adding your company name:
company_support_bot - Adding numbers:
ai_assistant_2026_bot - Using underscores:
my_custom_ai_bot
Advanced Configuration
Restricting Access
By default, anyone who finds your bot can message it. To restrict access, you can configure your OpenClaw agent to only respond to specific Telegram user IDs. This is done through the agent's skill configuration or by installing an access control skill from the marketplace at /app/marketplace.
Group Chat Support
Your Telegram bot can also be added to group chats. When added to a group, the bot will respond when mentioned with @your_bot_username or when replying to its messages. To enable this:
- Open BotFather and send
/setjoingroups. - Select your bot.
- Choose Enable.
Be aware that group chat messages can significantly increase credit usage as the bot may process more conversations.
Webhook vs Polling
EZClaws configures your Telegram bot to use webhooks by default, which is more efficient than polling. Webhooks mean Telegram sends messages directly to your agent's HTTPS endpoint in real time, rather than your agent repeatedly checking for new messages. This results in faster response times and lower resource usage.
The webhook URL is automatically configured using your agent's Railway domain:
https://your-agent-domain.up.railway.app/telegram/webhook
You do not need to configure this manually — EZClaws handles it automatically.
Integrating with Other Platforms
Telegram is just one of many messaging platforms you can connect to your OpenClaw agent. EZClaws also supports:
- Discord — See our Discord bot guide.
- Slack — See our Slack bot guide.
- WhatsApp — See our WhatsApp assistant guide.
For a complete list of supported integrations, visit our integrations page.
Understanding Credit Usage with Telegram
Every message processed by your Telegram bot consumes credits from your EZClaws account. The credit cost depends on:
- Input tokens — The length of the user's message plus any conversation context.
- Output tokens — The length of the agent's response.
- Tool usage — If the agent browses the web, executes code, or uses other tools to answer a question, additional tokens are consumed.
A typical conversational exchange costs between 0.1 and 0.5 cents in credits. Complex queries that require research or multi-step reasoning can cost more. Monitor your usage at /app/billing and set up usage alerts in your settings at /app/settings.
For tips on optimizing costs, read our guide on monitoring AI agent usage.
Summary
Connecting a Telegram bot to your EZClaws agent is a straightforward process that opens up a convenient, mobile-friendly interface for interacting with your AI. The steps are simple: create a bot with BotFather, copy the token, paste it into your EZClaws agent configuration, and start chatting.
Telegram integration makes your AI agent accessible anywhere — on your phone during a commute, on your desktop at work, or on a tablet at home. Combined with OpenClaw's powerful capabilities like web browsing, code execution, and email management, your Telegram bot becomes a genuinely useful AI assistant.
For more guides on getting the most out of EZClaws, visit our blog or explore other integration guides in our documentation.
Frequently Asked Questions
Yes. Telegram bots are completely free to create and use. The only costs are your EZClaws subscription and the model provider API usage, which are tracked through your EZClaws credit system.
Yes. Your Telegram bot can handle messages from multiple users simultaneously. Each conversation is treated as a separate session by the OpenClaw agent. Be aware that each conversation consumes credits from your EZClaws account.
Navigate to your agent's detail page at /app/agents/[id], click the settings or edit button, and update the Telegram Bot Token field with the new token. The agent will automatically reconnect with the new token.
No. Each Telegram bot token should be connected to exactly one EZClaws agent. If you need multiple agents on Telegram, create a separate bot for each one using BotFather.
No. The Telegram bot only responds when your EZClaws agent is in the 'Running' state. If your agent is stopped, paused, or in an error state, the bot will not respond to messages. Make sure your agent is running before testing the bot.
Explore More
From the Blog
Everything you need to know about managing API keys for your AI agent. Covers key generation for OpenAI, Anthropic, and Google, plus security best practices, cost controls, and rotation.
11 min read25 AI Agent Automation Ideas You Can Set Up TodayDiscover 25 practical AI agent automation ideas for business, productivity, community, and personal use. Each idea includes what the agent does, who it helps, and how to set it up on EZClaws.
16 min readAI Agent for Customer Support: A Real-World Case StudySee how a growing e-commerce company deployed an AI agent for customer support using OpenClaw and EZClaws, reducing response times by 85% and handling 70% of tickets autonomously.
12 min readReady to Deploy Your AI Agent?
Our provisioning engine spins up your private OpenClaw instance — dedicated VM, HTTPS endpoint, and full autonomy in under a minute.
