> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vecbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Telegram

> Connect your agent to Telegram via BotFather

# Telegram Setup

Connect your Vecbase agent to Telegram so users can chat with it directly in Telegram.

## Prerequisites

* A Telegram account
* A Vecbase agent created

## Step 1: Create a Bot with BotFather

<Steps>
  <Step title="Open BotFather">
    Open Telegram and search for **@BotFather** (the official Telegram bot management bot).
  </Step>

  <Step title="Create a new bot">
    Send `/newbot` to BotFather. It will ask you for:

    * **Bot name**: A display name (e.g., "My Company Assistant")
    * **Bot username**: Must end with `bot` (e.g., `mycompany_assistant_bot`)
  </Step>

  <Step title="Copy the bot token">
    BotFather will reply with your bot token. It looks like:

    ```
    8737604196:AAFspi44trCXi3fxDr50-v1g6gIdvageZQA
    ```

    **Keep this token secure** — anyone with it can control your bot.
  </Step>
</Steps>

## Step 2: Connect in Vecbase

<Steps>
  <Step title="Open agent settings">
    Open your agent, tap **Settings** in the top right, then select **Channels**.
  </Step>

  <Step title="Add Telegram channel">
    Click **Add Channel** next to **Telegram**.
  </Step>

  <Step title="Enter credentials">
    * **Display Name**: A name to identify this channel (e.g., "Customer Support Bot")
    * **Bot Token**: Paste the token from BotFather
  </Step>

  <Step title="Create">
    Click **Create**. The status will change to **Connected** within a few seconds.
  </Step>
</Steps>

## Step 3: Test

Open Telegram, find your bot by searching its username, and send a message. Your Vecbase agent will respond automatically.

## Bot Settings (Optional)

You can customize your bot in BotFather:

| Command           | Description                   |
| ----------------- | ----------------------------- |
| `/setdescription` | Set the bot's description     |
| `/setabouttext`   | Set the "About" text          |
| `/setuserpic`     | Set the bot's profile picture |
| `/setcommands`    | Set custom command menu       |

## Group Privacy (Recommended)

By default, Telegram bots can only see commands (messages starting with `/`) in group chats. To allow your agent to read all messages:

<Steps>
  <Step title="Open BotFather">
    In Telegram, open a chat with **@BotFather**.
  </Step>

  <Step title="Select your bot">
    Send `/mybots`, then select your bot from the list.
  </Step>

  <Step title="Open Bot Settings">
    Tap **Bot Settings** → **Group Privacy**.
  </Step>

  <Step title="Turn off privacy">
    Tap **Turn off**. BotFather will confirm: "Privacy mode is disabled."
  </Step>
</Steps>

<Info>
  With privacy mode disabled, the bot can read all messages in groups it's added to. This is required for the agent to respond to non-command messages.
</Info>

## Limitations

| Limit          | Value               |
| -------------- | ------------------- |
| File upload    | 50 MB (Bot API)     |
| File download  | 20 MB (getFile API) |
| Message length | 4,096 characters    |

<Info>
  Telegram bots can work in both **private chats** and **group chats**. In groups, the bot responds when mentioned with `@botusername`.
</Info>
