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

# Telegram

> Connect a Telegram bot to handle customer messages in PingBack.

Connecting a Telegram bot routes messages sent to that bot into your PingBack inbox. Agents can reply from PingBack and the reply is delivered back to the customer in Telegram.

<Note>Telegram is available on the **Mini** and **Pro** plans only.</Note>

## Prerequisites

Before you start, you need a Telegram bot token. If you don't have one yet:

1. Open Telegram and start a conversation with [@BotFather](https://t.me/BotFather).
2. Send `/newbot` and follow the prompts to name your bot.
3. BotFather will give you an **HTTP API token** — copy it.

## Setup

<Steps>
  <Step title="Create the Telegram channel in PingBack">
    Send a `POST` request to `/api/v1/channels/` with `type` set to `"telegram"` and your bot token in the `config` object.

    <CodeGroup>
      ```bash curl theme={null}
      curl -X POST https://api.pingback.live/api/v1/channels/ \
        -H "Authorization: Bearer <your_token>" \
        -H "Content-Type: application/json" \
        -d '{
          "type": "telegram",
          "config": {
            "bot_token": "123456789:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
          },
          "is_active": true
        }'
      ```

      ```json response theme={null}
      {
        "id": 17,
        "type": "telegram",
        "is_active": true,
        "config": {
          "bot_token": "123456789:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        }
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="Webhook registration (automatic)">
    PingBack automatically registers a webhook with Telegram's API when the channel is created. The webhook is set to:

    ```
    https://api.pingback.live/api/v1/webhooks/telegram/{channel_id}
    ```

    Where `{channel_id}` is the numeric `id` returned in the response above. You do not need to configure this manually.

    <Note>If the bot token is invalid or the webhook registration fails, the channel will not be created and PingBack will return an error. Double-check your token from BotFather.</Note>
  </Step>

  <Step title="Test the connection">
    Open Telegram and send a message to your bot. The message should appear as a new conversation in your PingBack inbox within seconds.
  </Step>
</Steps>
