---
title: "Connect Telegram"
description: "Create a Telegram bot, connect it to HolaClaw Server, and talk to your agent in a direct message or a group."
updated: 2026-11-17
canonical: https://holaclaw.ai/docs/server/connect-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](/docs/server/choose-a-deployment#where-things-are), for example `docker exec -i holaclaw holaclaw …` in the container.

## Step 1: Create the bot

1. In Telegram, open a chat with [@BotFather](https://t.me/BotFather).
2. Send `/newbot` and follow the prompts: a display name, then a username that ends in `bot`.
3. 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.

```toml title="channels.toml"
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](/docs/server/channels-toml#keys).

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:

```sh
read -rs TOKEN && printf %s "$TOKEN" | holaclaw auth set channels.tg-main bot_token; unset TOKEN
```

Paste 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](/docs/server/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](/docs/server/choose-a-deployment#where-things-are)). Then:

```sh
holaclaw check
holaclaw status
```

`check` 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:

```sh
holaclaw identity list
holaclaw invite create --identity <owner id> --channel tg-main
```

It 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.

> [!WARNING] 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:

```sh
holaclaw identity create --name Carla --invite tg-main
```

Send them the link it prints. [Invite people](/docs/server/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:

  ```sh
  holaclaw invite create --room --channel tg-main
  ```

  It 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](/docs/server/agent-toml#guests-and-tasks)).

## Next steps

- [Invite people](/docs/server/invite-people) and give them roles.
- Change who may reach the bot: [channels.toml reference](/docs/server/channels-toml).
- Add another channel: [WhatsApp](/docs/server/connect-whatsapp), [Google Chat](/docs/server/connect-google-chat) or [Slack](/docs/server/connect-slack).

