# 串接對話平台：LINE

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

* 已在 [MaiAgent 平台](https://admin.maiagent.ai/)上建立好一個「AI 助理」
* 已經在 [LINE Developers](https://developers.line.biz/zh-hant/) 的 console 平台建立好一個 「Provider」 以及一個 LINE 官方帳號 (Official Account)

<figure><img src="/files/tQSkHCYl6cnv3G0NUo0R" alt=""><figcaption></figcaption></figure>

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

### 1. 到 <https://manager.line.biz/> 選擇您想要串接的官方帳號 <a href="#step-select-line-official-account" id="step-select-line-official-account"></a>

點選 MaiAgent Testing：

<figure><img src="/files/j0bvLvYmDj355TOLRTql" alt=""><figcaption></figcaption></figure>

點選後會進入官方帳號設定的畫面：

<figure><img src="/files/4zZF8vraE43lrXppm2qb" alt=""><figcaption></figcaption></figure>

### 2. 點選右上角的設定 (Settings) <a href="#step-open-settings" id="step-open-settings"></a>

<figure><img src="/files/4e3UDrBUaUWCFyAKbOIc" alt=""><figcaption></figcaption></figure>

接著進入以下的畫面，點選左側 Messaging API 列表：

<figure><img src="/files/oN2JZImEpsutUM8fQZA3" alt=""><figcaption></figcaption></figure>

### 3. 啟用 Messaging API 服務 <a href="#step-enable-messaging-api" id="step-enable-messaging-api"></a>

a. 進入後，點按 <mark style="color:blue;">Enable Messaging API</mark>

<figure><img src="/files/ckWl0buK5gJJB9t2PN6I" alt=""><figcaption></figcaption></figure>

b. 選擇剛剛建立好的 Provider (若您剛剛尚未建立，仍可在這個頁面建立 Provider)

選擇完成後按下<mark style="color:blue;">確認(Agree)</mark>

<figure><img src="/files/EYaGfUGZo1puVvSO6VYa" alt=""><figcaption></figcaption></figure>

c. 傳入隱私權政策等文件 (可選)

下一步，您可以傳入您公司內部的隱私政策等文件網址，完成後按下 「ok」 前往下一步最終確認。

<figure><img src="/files/pyr40PQ5raIGhtClToHR" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
最後按下 ok 前請再次確認您連接的 Provider 是否正確，按下 ok 後即無法回復
{% endhint %}

<figure><img src="/files/ZjPLbXemAq3LlD42RjiM" alt=""><figcaption></figcaption></figure>

### 4. 取得 <mark style="color:blue;">Channel ID</mark>、<mark style="color:blue;">Channel Secret</mark>、<mark style="color:blue;">Channel Access Token</mark> <a href="#step-get-channel-credentials" id="step-get-channel-credentials"></a>

a. 按下 OK 後，您就可以取得該 Messaging API 服務的 <mark style="color:blue;">Channel ID</mark> 和 <mark style="color:blue;">Channel secret</mark>：

<figure><img src="/files/1X0s6gxnMN0C8L4fpVtJ" alt=""><figcaption></figcaption></figure>

b. 回到 [LINE Developers ](https://developers.line.biz/console/)頁面，取得 Channel Access Token

進入剛剛創建的 MaiAgent Provider 中

<figure><img src="/files/mWIuJgr6mXfiJaSLmECS" alt=""><figcaption></figcaption></figure>

c. 找到剛剛建立的 MaiAgent Testing Channel，點選進入

<figure><img src="/files/66T6HijpViiwPrDyNn0i" alt=""><figcaption></figcaption></figure>

d. 切換至 Messaging API 頁面，並往下捲動至 Channel access token 區域

<figure><img src="/files/uYKK4eQW1plxsxtjSVQp" alt=""><figcaption></figcaption></figure>

e. 發行 <mark style="color:blue;">Channel access token</mark> 並複製

若您尚未發行 <mark style="color:blue;">Channel access token</mark>，請點選 <mark style="color:blue;">Issue</mark>：

<figure><img src="/files/sBqbAdFpqJeHGNrl5OBY" alt=""><figcaption></figcaption></figure>

接著就能得到您的 <mark style="color:blue;">Channel access token</mark> 並複製使用：

<figure><img src="/files/Ze3ENQiaM4xwFFdnD8GT" alt=""><figcaption></figcaption></figure>

### 5. 到您的 MaiAgent 的對話平台，選擇 LINE <a href="#step-select-line-in-maiagent" id="step-select-line-in-maiagent"></a>

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

<figure><img src="/files/kHRKVenviYbzhvpwgr7R" alt=""><figcaption></figcaption></figure>

b. 選擇 LINE 作為串接平台

<figure><img src="/files/Xjaij1aqYPGqWaxYD9yV" alt=""><figcaption></figcaption></figure>

### 6. 填入名稱、選擇助理，貼上**剛取得的 Channel ID、Channel Secret、**&#x43;hannel Access Token <a href="#step-fill-channel-credentials" id="step-fill-channel-credentials"></a>

* **名稱：**&#x671F;望在網站上呈現的 AI 助理名稱
* **AI 助理：**&#x9078;擇要串接的 AI 助理
* **LINE 頻道：**&#x586B;入您的 「Channel ID」、「Channel Secret」、「Channel Access Token」

完成後按下右下角的 「串接對話平台」 按鈕，對話平台即準備就緒。

<figure><img src="/files/TGU0A8V2TJYa2eDxU26z" alt=""><figcaption></figcaption></figure>

### 7. 取得 Webhook 網址 <a href="#step-get-webhook-url" id="step-get-webhook-url"></a>

至對話平台選取剛建立的 LINE 頻道，點選操作，於 API 區塊取得 Webhook 網址

<figure><img src="/files/zcbERqhPQNpm63XyT2tV" alt=""><figcaption></figcaption></figure>

### 8. 在 <https://manager.line.biz/> 點選 「Settings/Messaging API」，貼上剛取得的Webhook 網址 <a href="#step-set-webhook-url-in-line" id="step-set-webhook-url-in-line"></a>

<figure><img src="/files/EsH5Ihdm2dD9axYNUnhP" alt=""><figcaption></figcaption></figure>

### 9. 在 <https://developers.line.biz/console/> 重新返回剛建立的 Messaging API 頻道，進行對話設定 <a href="#step-configure-messaging-api-channel" id="step-configure-messaging-api-channel"></a>

於 Auto-reply messages 點選 <mark style="color:blue;">Edit</mark> 按鈕

<figure><img src="/files/rlgNbXlEvlS0JJImBH8X" alt=""><figcaption></figcaption></figure>

將回應設定調整如下圖

<figure><img src="/files/IUMZXXH6FdBKNHRRYJL0" alt=""><figcaption></figcaption></figure>

### **10. 確認串接是否成功** <a href="#step-verify-integration" id="step-verify-integration"></a>

您可以試著加入您自己的 LINE **AI 助理**帳號進行對話

<figure><img src="/files/ltvNOOt0Ld2B6XEEmfzy" alt=""><figcaption></figcaption></figure>

如果相關對話可在 <https://manager.line.biz/> 和 MaiAgent 的所有對話中查看，就表示已成功串接！

<figure><img src="/files/g85bxP1IsergwNkvilEI" alt=""><figcaption></figcaption></figure>

## ⚠️ 重要注意事項 <a href="#important-notes" id="important-notes"></a>

**限制說明**

* LINE 群組僅能加入一個 AI 助理
* 新加入的 AI 助理會導致之前的被自動移除


---

# 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.maiagent.ai/conversations/line.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.
