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

# Telegram

> Connect Telegram to CostCare AI so your AI agents can respond to customer messages from Telegram.

# Telegram

Connect a Telegram bot to CostCare AI so your AI agents can receive and respond to messages from your customers on Telegram. You can connect a bot you already created with [BotFather](https://t.me/botfather), or create a new one from scratch.

## Connect an existing Telegram bot

<Steps>
  <Step title="Open BotFather">
    In Telegram, search for **BotFather** and open it. Make sure you're using the official, verified BotFather account.
  </Step>

  <Step title="Find your existing bot">
    In BotFather, choose your bot from **My Bots**, then open its settings/token screen.
  </Step>

  <Step title="Copy the bot token">
    Copy the HTTP API token. It looks like this:

    ```
    1234567890:ABCDefGhIJKlmnoPQRstuVWxyz...
    ```

    <Warning>
      Don't share this token publicly. Anyone with the token can control your bot.
    </Warning>
  </Step>

  <Step title="Open the CostCare dashboard">
    Go to **Dashboard → Channels** and click **Add new channel**.
  </Step>

  <Step title="Select Telegram">
    In the modal, choose **Telegram**, then click **Connect Telegram**.
  </Step>

  <Step title="Paste the token">
    Paste the BotFather token into the **Bot Token** field, then click **Connect Bot**.
  </Step>

  <Step title="Check that the channel was created">
    The Telegram channel should appear in the left channel list, showing something like:

    ```
    @your_bot_name
    Type: telegram
    Status: Disabled / AI inactive
    ```
  </Step>

  <Step title="Enable AI for the channel">
    * **Channels → Telegram channel → Enable AI for this channel**
  </Step>

  <Step title="Choose an agent">
    On the **Channels** page, open the **Agent** block for the channel and select an agent from the **Assigned agent** dropdown.
  </Step>

  <Step title="Test the bot">
    Open your bot in Telegram and send `/start`, then type your message. In CostCare, go to **Dashboard → Chats** — a new Telegram chat should appear with your message.
  </Step>
</Steps>

<Frame caption="Connecting an existing Telegram bot">
  <iframe src="https://www.loom.com/embed/5bb1f0aa0aef4ce883b44652a5b46ede" title="Connecting an existing Telegram bot" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" className="w-full aspect-video rounded-xl" allowFullScreen />
</Frame>

## Connect a new Telegram bot

<Steps>
  <Step title="Open BotFather">
    In Telegram, search for **@BotFather** and open the official bot.
  </Step>

  <Step title="Start bot creation">Send `/newbot`.</Step>

  <Step title="Enter a bot display name">
    When BotFather asks "Alright, a new bot. How are we going to call it?",
    enter the public-facing name, for example `CostCare Bot`. This name is shown
    to your customers.
  </Step>

  <Step title="Enter a bot username">
    Enter a username for the bot. It must be unique, use only Latin letters,
    numbers, or underscores, and end with `bot` — for example,
    `cool_costcare_bot`.
  </Step>

  <Step title="Copy the generated token">
    BotFather replies with "Use this token to access the HTTP API:" followed by
    the token. Copy it.
  </Step>

  <Step title="Connect it in CostCare">
    Go to **Dashboard → Channels → Add new channel**, choose **Telegram**, paste
    the token into **Bot Token**, then click **Connect Bot**.
  </Step>

  <Step title="Enable AI">
    Toggle **Disable AI in all chat**, then confirm **Yes, enable**. Send message
    from Telegram and check that the AI responds.
  </Step>

  <Step title="Choose an agent">
    On the **Channels** page, open the **Agent** block for the channel and select an agent from the **Assigned agent** dropdown.
  </Step>
</Steps>

<Frame caption="Creating and connecting a new Telegram bot">
  <iframe src="https://www.loom.com/embed/99d11c1ae205400d9c9ecc4952e781f5" title="Creating and connecting a new Telegram bot" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" className="w-full aspect-video rounded-xl" allowFullScreen />
</Frame>
