# Messenger

{% embed url="<https://www.youtube.com/watch?v=VhepoWkZFMU>" %}
Facebook integrate demo
{% endembed %}

**可以透過Facebook OAuth2 代管粉絲頁。**

另外可以直接填寫APP\_ID、APP\_SECRET、PAGE\_ID、VERIFY\_TOKEN以及ACCESS\_PAGE\_TOKEN直接操作。

以下連結是舊版的Facebook操作說明，大致上相同。此為補充如果通過APP REVIEW

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

APP REVIEW

**Request advanced access** pages\_messaging

如果pages\_messaging的按鈕還是灰色的，你可以

* <https://developers.facebook.com/docs/graph-api/get-started/>&#x20;
* <https://developers.facebook.com/tools/explorer>
* 根據上述說執行操作

將App mode: Development to LIVE，並新增測試人員帳號。並根據以下回答問題。

#### Tell us how you're using this permission or feature

填寫你需要pages\_messaging的原因。

提供測試帳號，注意此帳號目前只能使用真實帳號，此為中文教學，所以你必須使用2FA的方式登入，否則會被Facebook禁止登入。 下面是範例。

```
I'm building a chatbot with the Messenger Platform that will automatically answer people's questions about our services.To make the chatbot accessible to all Facebook users, I need the "pages_messaging" permission.

We'll provide the test account details below. We ensure the chatbot is thoroughly tested and functions well with our Tester and Developer accounts. Thank you.

Facebook tester account:
Email: ---example@gmail.com
Password: ---
```

#### Please provide step-by-step instructions to walk us through how to test this integration

```
Steps to test my Chatbot:

1. Going to my Facebook page: m.me/{{page_id}}
--Login to Facebook with Tester account with the following information:
+ Email: ---example@gmail.com
+ Password: ---

2. Test my chatbot.
```

### 待補充

* 技術提供者
* Business
* 2FA

### 選擇代管跟自行處理差別

#### 代管

* 優點可以快速連結機器人
* 缺點是你密碼更改或是你的權限有問題的時候，機器人會需要重新授權。

點擊 管理->設定->Facebook 取得連結粉絲頁連結，取得連結後選取您的粉絲頁即可完成。

<figure><img src="/files/S4bjSoC0Us1urYY8i2Ah" alt=""><figcaption><p>連結機器人</p></figcaption></figure>

<figure><img src="/files/ITqzCap8oN8OGGcrBCLI" alt=""><figcaption><p>開啟Facebook訊息</p></figcaption></figure>

點擊 機器人->選擇您的機器人後->設定->Facebook Messenger 設定->啟動代管->啟用並儲存。接下來您就可以收到Facebook訊息了。並可以設定Facebook留言回覆。

#### 自行處理

* DMflow\.chat可能會提供本地安裝版本，你就必須透過這個方式
* 你可以根據你的Page access token執行一些DMflow\.chat未提供的功能，例如:account\_link或是thread\_control等等。畢竟產品本身不限於單一渠道，你想要Messenger傳訊息給Telegram也未嘗不可。

### **留言回覆**

我們支援Facebook/Instagram留言回覆功能，那個說明目前是每小時支援200次(回覆留言、私人訊息以及隱藏和刪除)，這邊指的200次是指200次及時執行，**若每小時超過200次則會非及時執行(仍會執行完畢)。**

回覆留言第一層專業帳號留言是指，特別開放你自己的帳號留言在第一層留言也會回覆，這個功能只是讓你使用在測試而已。

若留言數量多，建議使用多組不同留言使用，或者只要使用私人訊息回覆即可。**私人訊息回覆重要性遠高於回覆留言。**

<figure><img src="/files/7sjOR0s8OECaCDFGm1BY" alt=""><figcaption><p>留言回覆</p></figcaption></figure>


---

# 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/messenger.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.
