# Telegram

{% embed url="<https://youtu.be/DO5-5-CCwm0>" %}
Telegram整合
{% endembed %}

與下面連結操作相同。

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

## Telegram開發設定 <a href="#telegram-kai-fa-she-ding" id="telegram-kai-fa-she-ding"></a>

在 Telegram 上創建新機器人的步驟如下：

* 在您的設備上打開 Telegram 應用程式。
* 在搜尋欄中搜尋 "BotFather" 機器人。
* 點擊 "BotFather" 並開始與它進行對話，點擊 "Start" 按鈕。
* 在與 BotFather 的對話中輸入 "/newbot" 來創建一個新機器人。
* 跟隨 BotFather 提供的指示。它會要求您為機器人提供一個名稱（例如 "MyNewBot"）和一個唯一的用戶名（例如 "@MyNewBot"）。
* 提供所需的資訊後，BotFather 將為您的機器人生成一個 API 金鑰。請確保保持此金鑰安全，因為它用於訪問 Telegram Bot API。
* 您的新機器人現在已經創建完成。您可以通過 BotFather 對話或使用生成的 API 金鑰通過 Telegram Bot API 訪問和管理其設定。

![DmFlow整合Telegram](https://docs.communeify.com/images/tw/telegram-001.jpg)

下圖紅色遮住部分為token，將其token複製。

![DmFlow整合Telegram](https://docs.communeify.com/images/tw/telegram-002.jpg)

如需要在群組中接收全部訊息，可透過以下去操作，一般預設只接收command "/"開頭的訊息。

![DmFlow整合Telegram](https://docs.communeify.com/images/tw/telegram-group-disabled-slash.jpg)

進入DmFlow系統，點選你的機器人後，進入設置->第三方整合->Telegram，並將圖二的token冒號前純數字填入APP\_ID，token則是填入全部"58XXXXXXXX:AAEXXXXXXXXXXEBXXXXXXX"，選取"啟用"並儲存，後台會驗證填寫是否正確。

![DmFlow整合Telegram](https://docs.communeify.com/images/tw/telegram-setting-page.png)

## 設置Webhook <a href="#she-zhi-webhook" id="she-zhi-webhook"></a>

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

將token取代{{token}}

Body

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

將Webhook URL取代{{Webhook URL}}

## 刪除Webhook <a href="#shan-chu-webhook" id="shan-chu-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.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.
