> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/build/choose-channel/fb.md).

# 串接對話平台：FB Messenger

將 Agent 串接到 Facebook 粉絲專頁的 Messenger，前置權限、授權流程與常見問題

## <mark style="color:blue;">串接前確認</mark> <a href="#pre-integration-checklist" id="pre-integration-checklist"></a>

**MaiAgent 準備**

* 已在 [MaiAgent 平台](https://admin.maiagent.ai/)上建立好一個「AI 助理」

**Facebook 權限準備**

* Facebook 帳號已被邀請或建立過商家資產管理組合
* 擁有該商家資產管理組合的「完整控制權限」

**粉絲專頁權限確認**

* 如果粉專已在商家資產管理組合下：無需額外調整
* 如果粉專不在商家資產管理組合下：必須是該粉絲專頁的管理人員且擁有完整控制權限

{% hint style="info" %}
**還沒有商家資產管理組合？** 請先依 Meta 官方說明[建立商家資產管理組合](https://www.facebook.com/business/help/1710077379203657)，建立者會自動擁有完整控制權限。

**如何確認自己有完整控制權限？** 到 [Meta Business Suite](https://business.facebook.com/) 的 <mark style="color:blue;">設定 → 用戶 → 人員</mark>，點選自己的名字查看權限。若只有部分存取權限，請組合內有完整控制權限的成員協助調整，權限說明詳見 [Meta 官方說明](https://www.facebook.com/business/help/442345745885606)。

**粉專要先加進商家資產管理組合嗎？** 不一定要。授權時可以直接認領粉專；若想事先整理好，也可以依 [Meta 官方說明](https://www.facebook.com/business/help/720478807965744)把粉專加進組合。
{% endhint %}

{% hint style="warning" %}
一個粉絲專頁只能串接到一個對話平台。若要換綁到其他 Agent，請先刪除原本的對話平台再重新串接。要串接同一粉專連結的 Instagram 私訊，請另外建立 [Instagram](/build/choose-channel/instagram.md) 對話平台。
{% endhint %}

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-d6d1aa18fa70dede47b7daeaed0a4f0eadf3febf%2Fimage%20(12)%20(1).png?alt=media&amp;token=b74d95f5-058c-4543-9f6d-1a199466313b" alt=""><figcaption></figcaption></figure>

## <mark style="color:blue;">開始串接</mark> <a href="#start-integration" id="start-integration"></a>

### 1. 到 MaiAgent 的對話平台頁面，點選「串接對話平台」 <a href="#step-go-to-maiagent-channel-page" id="step-go-to-maiagent-channel-page"></a>

a. 點選右上角<mark style="color:blue;">串接對話平台</mark>

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-45051526831861d07352f6b1084732e923c9fa5b%2Fimage%20(102).png?alt=media&amp;token=79b5d3df-f535-41a3-9d1b-4405925b1bd0" alt=""><figcaption></figcaption></figure>

b. 選擇 Messenger

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-54c2a072dbdd6e95a23e672d6d7779e764381955%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-21%20122626.png?alt=media" alt=""><figcaption></figcaption></figure>

c. 點擊 <mark style="color:blue;">Facebook 登入</mark>，以管理該粉專的 Facebook 帳號登入。MaiAgent 只會存取您授權的粉絲專頁訊息，不會存取您的個人訊息。

{% hint style="warning" %}
請確認瀏覽器允許彈出視窗，否則 Facebook 登入視窗可能被封鎖。
{% endhint %}

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-dc446ea48022138a20907b9d1282def9e546042a%2Fimage%20(5)%20(1)%20(1)%20(1).png?alt=media&amp;token=87122f07-52cf-4f0c-8cea-8bf5b04aa3d3" alt=""><figcaption></figcaption></figure>

### 2. 選擇商家，並選擇（認領）粉專。 <a href="#step-select-business-and-page" id="step-select-business-and-page"></a>

在 Facebook 授權視窗中，先選擇要授權的商家資產管理組合，再勾選要託管（認領）的粉絲專頁。

確定授權，建立成功後即完成託管。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-711739d48ba4820003d4771f15abed0475eff185%2Fimage%20(13)%20(1).png?alt=media&amp;token=59c3b2d7-8fe1-4aa6-aa91-7a2ba542cf14" alt=""><figcaption></figcaption></figure>

### 3. Agent 設定 <a href="#step-ai-agent-settings" id="step-ai-agent-settings"></a>

| 欄位         | 說明                                                                 |
| ---------- | ------------------------------------------------------------------ |
| **對話平台名稱** | 為此串接取一個名稱，方便辨識                                                     |
| **AI 助理**  | 選擇要回覆 Messenger 訊息的 Agent                                          |
| **選擇粉專**   | 從 <mark style="color:blue;">Messenger 頻道</mark> 區塊的清單中選擇您剛剛認領的粉絲專頁 |
| **啟用重置命令** | （選填）開啟後可設定一個或多個指令，使用者在 Messenger 送出該指令時會重新開始一段新對話，例如「重新開始」         |

{% hint style="info" %}
若授權後粉專清單沒有更新，可點擊 <mark style="color:blue;">Messenger 頻道</mark> 區塊右上角的 <mark style="color:blue;">重新載入</mark> 重新授權一次。
{% endhint %}

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-0bd1984760eed7ad89aaf3ddcfb63d6aaab0c98b%2Fimage%20(106).png?alt=media&amp;token=7bb429b8-f373-4960-8fda-471600c2fc0c" alt=""><figcaption></figcaption></figure>

### 4. 確認串接結果 <a href="#step-verify-integration" id="step-verify-integration"></a>

接著您可以在 MaiAgent 的內部對話試著針對該對話平台送出一個測試訊息，Agent 如可以正常回覆對話，表示串接已成功。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-1542ac8f364fb8abc6d3679953254b1d50961586%2Fimage%20(14)%20(1).png?alt=media&amp;token=e846076c-ab58-47c8-b6fb-f9e5907de3cb" alt=""><figcaption></figcaption></figure>

您也可以到該粉專開啟 Agent 對話，送出測試訊息，機器人如可以正常回覆對話，表示串接已成功。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-74d2aed8c0d151071b721aba80dbfe3627258b24%2Fimage%20(10)%20(1)%20(1).png?alt=media&amp;token=8238d2a2-7196-4b6e-ab0e-a17fa05dc641" alt=""><figcaption></figcaption></figure>

串接成功後，MaiAgent 會自動向 Meta 訂閱該粉專的訊息事件，不需要另外設定 Webhook。

{% hint style="info" %}
串接成功後，可在對話平台列表點擊編輯，進一步設定功能選項（OCR 辨識、使用系統時間或傳送者名稱回答、客服轉真人、對話標籤、權限控管等），詳見[對話平台設定總覽](/build/conversation-settings/platform-settings.md)。
{% endhint %}

## <mark style="color:blue;">支援的訊息類型</mark> <a href="#supported-message-types" id="supported-message-types"></a>

| 方向          | 支援內容                        |
| ----------- | --------------------------- |
| 使用者 → Agent | 文字、圖片、影片、語音、貼圖；圖片可搭配 OCR 辨識 |
| Agent → 使用者 | 文字、圖片                       |

* **Markdown 自動轉純文字**：Messenger 不會渲染 Markdown，Agent 回覆中的標題、粗斜體、連結、表格等語法在送出前會自動轉成純文字（連結變成「文字 網址」），真人客服打的字不受影響，見 [訊息內容渲染優化：通訊軟體通道](/build/choose-channel/web-chat/markdown-rendering.md#messaging-channels-plain-text)
* **連續訊息合併成一輪**：使用者連續傳多張圖片、或先傳圖再打字時，Agent 會等這一串訊息到齊（只含圖片的訊息，最後一則後約 4 秒沒有新訊息才回答，最長約 20 秒，收到文字就立刻回）後一次回答；同一對話一次只處理一輪
* **24 小時回覆期限**：Meta 只允許在使用者最後一則訊息後 24 小時內回覆，超過期限送出的訊息會在對話頁標示 [未送達](/serve/daily-operations/reply.md#delivery-failed)

## <mark style="color:blue;">常見問題</mark> <a href="#faq" id="faq"></a>

### Q：授權後粉專清單是空的？ <a href="#faq-empty-page-list" id="faq-empty-page-list"></a>

登入的 Facebook 帳號沒有該粉專的完整控制權限，或授權時沒有勾選該粉專。請先依[串接前確認](#pre-integration-checklist)檢查權限，再以粉專管理員身分重新登入，並在授權視窗中確認勾選正確的粉專。

### Q：儲存時顯示「此頁面 ID 已被使用」？ <a href="#faq-page-already-used" id="faq-page-already-used"></a>

同一個粉絲專頁已串接到組織內另一個對話平台。請先刪除原本的對話平台，再重新建立。

### Q：使用者傳訊息了，但 MaiAgent 沒有收到？ <a href="#faq-no-incoming-message" id="faq-no-incoming-message"></a>

請確認授權的 Facebook 帳號仍是該粉專的管理員，且粉專仍在授權時選擇的商家資產管理組合內。若授權過期或粉專權限被移除，請刪除對話平台後重新串接。

### Q：Messenger 與 Instagram 可以共用同一個 Agent 嗎？ <a href="#faq-share-agent" id="faq-share-agent"></a>

可以。兩者是各自獨立的對話平台，可以綁定同一個 Agent，也可以各自設定不同的功能選項。Instagram 的串接方式請見[串接對話平台：Instagram](/build/choose-channel/instagram.md)。

### Q：如何移除（取消串接）Messenger？ <a href="#faq-disconnect" id="faq-disconnect"></a>

到 <mark style="color:blue;">對話平台</mark> 列表，在該 Messenger 平台的操作欄點 <mark style="color:blue;">刪除</mark> 並確認（沒有刪除權限時圖示會停用）。刪除後 MaiAgent 不再接收與回覆這個粉專的訊息；需要保留對話紀錄的，請先在 <mark style="color:blue;">所有對話</mark> 匯出。MaiAgent 不會替您收回 Facebook 端的授權，要徹底解除請再到該粉絲專頁的設定移除對 MaiAgent 應用程式的授權。之後要重新串接，依 [開始串接](#start-integration) 重做一次即可。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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 following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/build/choose-channel/fb.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
