> ## Documentation Index
> Fetch the complete documentation index at: https://docs-agents.fpt.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tích hợp LINE

Sau khi xây dựng xong AI Agent, người dùng có thể tích hợp Agent đó lên kênh LINE để cho khách hàng tương tác.

Các bước thực hiện tích hợp như sau:

***

#### Bước 1: Tạo LINE Official Account

Để tích hợp được AI Agent với LINE, người dùng cần có Tài khoản chính thức của kênh LINE. Nếu chưa có, bạn có thể thực hiện theo các bước sau để tạo tài khoản:

1. Đăng nhập vào **Developers Console** theo link `https://developers.line.biz/console/`
2. Tại màn hình chính của Console, nhấn **"Creating a new provider"** và nhập tên của nhà cung cấp để tạo nhà cung cấp mới.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image484.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=78b3605d1c8696fdd843366b0e4f0ebc" alt="Image484" width="1920" height="911" data-path="images/image484.png" />

3. Tại trang **Providers > Provider vừa tạo**, nhấn chọn **"Create a Messaging API channel"**.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image485.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=fcf4ea0daac53f42b6b8952b83a33eea" alt="Image485" width="1920" height="911" data-path="images/image485.png" />

4. Nhấn nút **"Create a LINE Official Account"** để tạo OA mới.
5. Tiếp tục nhập thông tin theo yêu cầu để tạo Official Account. Sau khi tạo OA thành công, hệ thống chuyển hướng sang màn hình **LINE Official Account Manager** `https://manager.line.biz/account/`

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image486.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=6c9141e3e637e8191e611de4b427add5" alt="Image486" width="1920" height="911" data-path="images/image486.png" />

***

#### Bước 2: Cấu hình LINE Webhook

1. Chọn tab **"Settings"** tại góc phải màn hình > Chọn **Messaging API**. Lúc này trạng thái đang là **Disable**, bạn cần nhấn nút **"Enable Messaging API"** để thực hiện cấu hình.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image487.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=0b1279405ac9ce456305a8342141f298" alt="Image487" width="1920" height="911" data-path="images/image487.png" />

2. Chọn **Provider** bạn muốn vận hành account này, sau đó đồng ý ở các màn hình tiếp theo.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image488.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=19ddf8ed4072fa131f690d1c09d3b189" alt="Image488" width="1920" height="911" data-path="images/image488.png" />

3. Sau khi đồng ý enable Messaging API, hệ thống LINE yêu cầu nhập **Webhook URL** từ AI Agent, và hiển thị thông tin **Channel ID**, **Channel secret** để bạn sử dụng cấu hình trong AI Agent.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image489.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=2d6ed872bd2df71fb5256d57c5513b64" alt="Image489" width="1920" height="911" data-path="images/image489.png" />

4. Truy cập vào `agents.fpt.ai` > tab **Triển khai** > **Tích hợp kênh chat** > **LINE** > Nhấn chọn **LINE**, hệ thống hiển thị yêu cầu cấu hình.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image490.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=fee6724faee1016c9e766d95c28c7607" alt="Image490" width="1920" height="911" data-path="images/image490.png" />

5. Copy **URL Webhook** tại AI Agents và dán vào trường **Webhook URL** của LINE Official Account Manager.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image491.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=0c9817823a35b5c0c8c2616d78e3bce1" alt="Image491" width="1627" height="638" data-path="images/image491.png" />

6. **Verify webhook**: Truy cập lại vào **LINE Developers Console** `https://developers.line.biz/console` > chọn **Providers** đã thêm OA > Chọn tab **Messaging API** > Tại mục **Webhook settings**, trường **Webhook URL**, nhấn nút **"Verify"** > Tại trường **Use webhook**, nhấn bật.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image492.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=8e2363ad3fff64ec02e1caf83a66b739" alt="Image492" width="1085" height="872" data-path="images/image492.png" />

***

#### Bước 3: Cấu hình thông tin của LINE trên AI Agent và kết nối

1. Copy **Channel ID** và **Channel secret** (trên LINE Official Account Manager) dán vào trường tương ứng **ID kênh** và **Khóa bí mật của kênh** (trên AI Agent). Bạn có thể lấy thông tin từ trang **LINE Official Account Manager** (Settings > Messaging API) hoặc **LINE Developers Console** (Providers > chọn OA > Basic settings).

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image493.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=f98294cc4455db0f3f9547a120a87855" alt="Image493" width="1619" height="660" data-path="images/image493.png" />

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image494.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=4f4c48567b438a045030b11ac5b1352f" alt="Image494" width="968" height="733" data-path="images/image494.png" />

2. Truy cập lại vào **LINE Developers Console** `https://developers.line.biz/console` > chọn **Providers** đã thêm OA > Chọn tab **Messaging API** > Kéo xuống cuối trang bạn sẽ thấy **"Channel access token (long-lived)"** > Nhấn nút **Issue** > Copy mã token và dán vào **Token truy cập kênh** của AI Agent.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image495.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=d298b9b87e9e5b03b9609bf8860f0e08" alt="Image495" width="2403" height="911" data-path="images/image495.png" />

3. Nhấn **Kết nối**. Sau khi điền đủ thông tin trên cấu hình LINE của AI Agent, nhấn **"Kết nối"**, hệ thống thông báo tích hợp thành công và hiển thị tên OA LINE đã tích hợp.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image496.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=3c8fce95fd44731a15ac5494fb83d0a0" alt="Image496" width="1897" height="396" data-path="images/image496.png" />

***

#### Bước 4: Kiểm thử tích hợp

Người dùng cần kiểm tra Agent tích hợp thành công trên kênh LINE bằng cách **quét mã QR** của LINE OA và kiểm thử.

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image497.png?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=e1c82816213e281fabb0fbca91f666f2" alt="Image497" width="1032" height="816" data-path="images/image497.png" />

<img src="https://mintcdn.com/fpt-62e894b4/ArAE2Tf09bC-y77-/images/image498.jpeg?fit=max&auto=format&n=ArAE2Tf09bC-y77-&q=85&s=4f56308e1bcaffca41e105b597a66189" alt="Image498" width="430" height="930" data-path="images/image498.jpeg" />
