# Telegram

The integration with Telegram follows the steps outlined in the linked tutorial.

{% embed url="<https://docs.communeify.com/en/products/dmflow/tutorials/docs/telegram.html>" %}

## Apply for a Telegram bot <a href="#apply-for-a-telegram-bot" id="apply-for-a-telegram-bot"></a>

To create a new bot on Telegram, follow these steps:

* Open the Telegram app on your device.
* Search for the "BotFather" bot in the search bar.
* Start a chat with BotFather by clicking on it and then clicking the "Start" button.
* Type "/newbot" in the chat with BotFather to create a new bot.
* Follow the instructions provided by BotFather. It will ask you to provide a name for your bot (e.g., "MyNewBot") and a unique username for your bot (e.g., "@MyNewBot").
* Once you have provided the required information, BotFather will generate an API token for your bot. Make sure to keep this token secure as it is used to access the Telegram Bot API.
* Your new bot is now created. You can access and manage its settings through BotFather's chat or by using the generated API key to interact with the Telegram Bot API.

![DmFlow integrate with Telegram](https://docs.communeify.com/images/en/telegram-001.jpg)

The token is covered by a red box in the image below. Please copy the token.

![DmFlow integrate with Telegram](https://docs.communeify.com/images/en/telegram-002.jpg)

If you want to receive all messages in a group, you can follow these steps. By default, only messages starting with the command "/" are received.

![DmFlow integrate with Telegram](https://docs.communeify.com/images/en/telegram-group-disabled-slash.jpg)

To configure your Telegram integration in the DmFlow system, select your bot, go to Settings -> Third-Party Integrations -> Telegram. Enter the numeric portion of the token before the colon (:) in the APP\_ID field, and enter the complete token "58XXXXXXXX:AAEXXXXXXXXXXEBXXXXXXX" in the token field. Select "Enable" and save. The system will verify if the provided information is correct.

![DmFlow integrate with Telegram](https://docs.communeify.com/images/en/telegram-setting-page.png)

## Setting Webhook <a href="#setting-webhook" id="setting-webhook"></a>

```awk
https://api.telegram.org/bot{{token}}/setWebhook
```

token replaced {{token}}

Body

```handlebars
{
    "url":"{{Webhook URL}}"
}
```

Webhook URL replaced {{Webhook URL}}

## Delete Webhook <a href="#delete-webhook" id="delete-webhook"></a>

```awk
https://api.telegram.org/bot{{token}}/deleteWebhook
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-en.dmflow.chat/channel/telegram.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
