Connect Telegram
Create a Telegram bot, connect it to HolaClaw Server, and talk to your agent in a direct message or a group.
- Server
- Channels
- Telegram
This guide connects your HolaClaw Server agent to a Telegram bot of your own. When you finish, you can message the agent from Telegram, and add it to groups you approve.
Telegram is the quickest channel to set up: you need a Telegram account and a few minutes. The bot connects out to Telegram, so the server needs no public address and no open port.
Commands are written as holaclaw …. Run them the way your deployment does, for example docker exec -i holaclaw holaclaw … in the container.
Step 1: Create the bot
- In Telegram, open a chat with @BotFather.
- Send
/newbotand follow the prompts: a display name, then a username that ends inbot. - Copy the token BotFather sends back. It looks like
123456789:AA….
Treat the token like a password: whoever has it controls the bot.
Step 2: Add the channel
Add a channel instance to channels.toml, in the config directory. The name in brackets (tg-main here) is yours to choose; you use it in the commands below.
version = 1
[channels.tg-main]
type = "telegram"
agent = "main"
[channels.tg-main.access]
dm = "invite"
rooms = "approved"
reply = "mention"
reply_to = "rooms"With these settings, the bot answers only people you invite, answers in groups you approve, and replies in a group only when someone mentions it. Every key and value is in the channels.toml reference.
If the file already has version = 1 and other channels, add only the two tables.
Step 3: Store the token
The token goes in auth.toml, never in channels.toml. auth set reads it from stdin, so it stays out of your shell history:
read -rs TOKEN && printf %s "$TOKEN" | holaclaw auth set channels.tg-main bot_token; unset TOKENPaste the token and press Enter. Because the channel is already in channels.toml, auth set checks the token with Telegram first and prints verified @<bot username>. A token Telegram rejects is not stored. See Secrets for where the file lives.
Step 4: Restart and check
The daemon reads channels.toml only when it starts, so restart it (docker restart holaclaw, sudo systemctl restart holaclaw, or the command for your deployment). Then:
holaclaw check
holaclaw statuscheck reports SEC003 if the token is missing. In status, the channel's row should read connected.
Step 5: Say hello
The bot answers only people who have redeemed an invite. Start with yourself, the owner. Find your identity id, then mint a one-shot invite for this channel:
holaclaw identity list
holaclaw invite create --identity <owner id> --channel tg-mainIt prints a code, a t.me link and a QR code of the link. Open the link on your phone, or scan the QR code, and tap Start in Telegram. You can also send /start <code> to the bot, or the code by itself.
The bot links your Telegram account to your identity and answers. From then on, write to it like to anyone else. The code works once, on this channel only, for 15 minutes by default.
An owner code is for the owner
Whoever redeems an invite becomes that identity, with its role. Never send a code minted for your own identity to someone else.
To let someone else in, create an identity for them with its first invite:
holaclaw identity create --name Carla --invite tg-mainSend them the link it prints. Invite people covers roles, other channels and removing access.
Use it in a group
With rooms = "approved", the bot answers in a group only once the group is approved. There are two ways:
Add it yourself. If you are a linked owner or admin, add the bot to the group from Telegram. Adding it approves the group.
Send a group invite. Mint a room invite:
Terminalholaclaw invite create --room --channel tg-mainIt prints a link. Tapping it asks which group, adds the bot and approves that group in one step. Tapping the link does not link the person who taps it to any identity.
If anyone else adds the bot to a group, nothing is approved and the bot stays silent there.
In an approved group, mention the bot to talk to it. People in the group who have no invite of their own talk to it as guests, under the agent's guest policy (see agent.toml).
Next steps
- Invite people and give them roles.
- Change who may reach the bot: channels.toml reference.
- Add another channel: WhatsApp, Google Chat or Slack.
Was this page helpful?
