Course: OpenClaw — Autonomous AI Agents | Pathway: Builder | Tier: Free | Level: Beginner Estimated Reading Time: 12 minutes
In the last lesson, you created an agent and chatted with it through the web interface. That works, but it is a bit like having a phone that can only make calls from your desk.
The real power of an autonomous agent comes when people can reach it where they already are — on Telegram, Discord, or other platforms they use every day.
OpenClaw calls these connections "channels." A channel is simply a link between your agent and an external chat platform. Your agent can be connected to multiple channels at once, so it might respond on Telegram, Discord, and the web interface all at the same time.
Telegram is one of the easiest platforms to connect, and it is the one we use most at Lalapanzi.ai. Here is how to set it up.
Open Telegram and search for @BotFather. This is Telegram's official bot for creating other bots.
Send BotFather the command:
/newbot
BotFather will ask you two things:
Once you have answered both, BotFather will give you an API token. It looks something like this:
6123456789:ABCDefGhIjKlMnOpQrStUvWxYz
Copy this token. You will need it in the next step. Keep it private — anyone with this token can control your bot.
Open your .env file in the OpenClaw directory:
nano ~/openclaw/.env
Add your Telegram bot token:
TELEGRAM_BOT_TOKEN=6123456789:ABCDefGhIjKlMnOpQrStUvWxYz
Save and close the file.
Open your agent's configuration file:
nano ~/openclaw/agents/helper/config.yaml
Add the Telegram channel:
name: Helper
model: openrouter/google/gemini-2.0-flash-exp:free
description: A friendly general-purpose assistant
channels:
- type: telegram
enabled: true
Restart OpenClaw:
npm start
Now open Telegram, find your bot by searching for its username, and send it a message. Your agent should respond.
That is it. Your agent is now live on Telegram.
Discord is popular with communities, gaming groups, and increasingly with workplaces. Connecting it takes a few more steps than Telegram, but it is still straightforward.
Go to the Discord Developer Portal and log in with your Discord account.
Click "New Application" and give it a name (e.g., "Helper Bot").
In your new application, go to the "Bot" section in the left sidebar. Click "Add Bot."
You will see a token section. Click "Reset Token" to generate a new token, and copy it. Like the Telegram token, keep this private.
You also need to enable some "Privileged Gateway Intents":
Go to the "OAuth2" section, then "URL Generator."
Under "Scopes," check bot. Under "Bot Permissions," check:
Copy the generated URL and open it in your browser. You will be asked which server to add the bot to. Pick your server and confirm.
Open your .env file and add:
DISCORD_BOT_TOKEN=your_discord_bot_token_here
Update your agent's config:
name: Helper
model: openrouter/google/gemini-2.0-flash-exp:free
description: A friendly general-purpose assistant
channels:
- type: telegram
enabled: true
- type: discord
enabled: true
Restart OpenClaw and your bot should appear online in your Discord server. Send it a message and it should respond.
By default, your agent will respond to anyone who messages it. On Telegram, that means anyone who finds your bot can chat with it. On Discord, it responds in any channel it has access to.
This might not be what you want. OpenClaw lets you set DM (direct message) policies to control access.
In your agent's config, you can add:
dm_policy:
allow_list:
- telegram:123456789
- discord:987654321
This restricts your agent to only respond to specific user IDs. Anyone else who messages the bot will be ignored.
You can find your Telegram user ID by messaging @userinfobot on Telegram. For Discord, enable Developer Mode in settings, then right-click your username and select "Copy User ID."
If you want your agent to be open to everyone, simply leave out the dm_policy section.
Agents can also participate in group chats, not just direct messages.
On Telegram, add your bot to a group. By default, bots in Telegram groups can only see messages that start with a / command or that mention the bot by name. If you want your bot to see all messages in the group, you need to disable "Privacy Mode" through BotFather:
/setprivacy
Select your bot, then choose "Disable."
On Discord, your bot can respond in any text channel it has access to. You control which channels it can see through Discord's role and permission system.
A word of caution about group chats: if your agent responds to every message, it can quickly become noisy and annoying. Consider setting up your agent to only respond when mentioned by name, or to specific trigger words.
You can handle this in the SOUL.md:
## Group Chat Behaviour
When in a group chat:
- Only respond when someone mentions you by name or asks a direct question.
- Do not interrupt ongoing conversations between other people.
- Keep responses shorter than in direct messages.
One of the nice things about OpenClaw is that a single agent can be connected to multiple channels at the same time. Your Helper agent could be on Telegram, Discord, and the web interface simultaneously.
Each channel is independent — conversations on Telegram do not bleed into Discord. The agent treats each channel as a separate conversation context.
You can also have different agents on different channels. Maybe your general-purpose agent is on Telegram, while a specialised research agent is on Discord. OpenClaw's gateway handles the routing.
For your agent to respond on Telegram or Discord, OpenClaw needs to be running. If you close your terminal or shut down your computer, the bot goes offline.
For a personal project, this is fine — just start OpenClaw when you need it.
For something more persistent, you have options:
pm2 to keep OpenClaw running in the background and restart it if it crashes.We will not cover server deployment in this course, but it is worth knowing the option is there for when you are ready.
A few things to keep in mind when your agent is connected to external platforms:
Your agent can now chat with people on Telegram and Discord. In the next lesson, we will make it truly autonomous by setting up cron jobs — scheduled tasks that your agent runs automatically without anyone prompting it.
Key Takeaways