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

# Telegram

> Build a Rasa Chat Bot on Telegram

You first have to create a Telegram bot to get credentials.
Once you have them you can add these to your `credentials.yml`.

## Getting Credentials

**How to get the Telegram credentials:**
You need to set up a Telegram bot.

1. To create the bot, go to [Bot Father](https://web.telegram.org/#/im?p=@BotFather),
   enter `/newbot` and follow the instructions. The URL that Telegram should send messages to will look like
   `http://<host>:<port>/webhooks/telegram/webhook`, replacing
   the host and port with the appropriate values from your running Rasa server.
2. At the end you should get your `access_token` and the username you
   set will be your `verify`.
3. If you want to use your bot in a group setting, it's advisable to
   turn on group privacy mode by entering `/setprivacy`. Then the bot
   will only listen when a user's message starts with `/bot`.

For more information, check out the [Telegram HTTP API](https://core.telegram.org/bots/api).

## Running on Telegram

Add the Telegram credentials to your `credentials.yml`:

```yaml theme={null}
telegram:
  access_token: "490161424:AAGlRxinBRtKGb21_rlOEMtDFZMXBl6EC0o"
  verify: "your_bot"
  webhook_url: "https://your_url.com/webhooks/telegram/webhook"
```

Restart your Rasa server
to make the new channel endpoint available for Telegram to send messages to.

<Note>
  **Handling /start message**

  At the beginning of a conversation, the user will press the 'Start' button in Telegram.
  This will trigger a message with the content */start* to be sent.
  Make sure your bot can handle this intro message by designing a specific intent in the nlu training data file.
  Then add this `start` intent to the domain alongside a story or rule to handle it.
</Note>

## Supported Response Attachments

In addition to standard `text:` responses, this channel also supports the following components from the [Telegram API](https://core.telegram.org/bots/api/#message):

* `button` arguments:
  * button\_type: inline | vertical | reply
* `custom` arguments:
  * photo
  * audio
  * document
  * sticker
  * video
  * video\_note
  * animation
  * voice
  * media
  * latitude, longitude (location)
  * latitude, longitude, title, address (venue)
  * phone\_number
  * game\_short\_name
  * action

Examples:

```yaml theme={null}

  utter_ask_transfer_form_confirm:
  - buttons:
    - payload: /affirm
      title: Yes
    - payload: /deny
      title: No, cancel the transaction
    button_type: vertical
    text: Would you like to transfer {currency}{amount_of_money} to {PERSON}?
    image: "https://i.imgur.com/nGF1K8f.jpg"
```

```yaml theme={null}
  utter_giraffe_sticker:
  - text: Here's my giraffe sticker!
    custom:
      sticker: "https://github.com/TelegramBots/book/raw/master/src/docs/sticker-fred.webp"
```


## Related topics

- [Rasa Pro Change Log](/docs/reference/changelogs/rasa-pro-changelog.md)
- [Connecting to Messaging and Voice Channels](/docs/reference/channels/messaging-and-voice-channels.md)
- [Python Versions and Dependencies](/docs/reference/python-versions-and-dependencies.md)
- [External Sub Agent](/docs/reference/config/agents/external-sub-agents.md)
- [Custom Connectors](/docs/reference/channels/custom-connectors.md)
