> ## 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 Microsoft Teams

### Tích hợp Microsoft Teams

Để kết nối AI Agent với Microsoft Teams, bạn cần thiết lập **Bot** và **Ứng dụng (App)** trên nền tảng Teams.

<Note>
  Nếu bạn đã **có sẵn cả Bot và App**, vui lòng **bỏ qua Bước 1 và Bước 2**, chuyển đến **Bước 3**.
</Note>

***

**Bước 1**: Tạo Bot trên Microsoft Teams

Đảm bảo bạn có quyền truy cập Azure Active Directory (Azure AD) để có thể tạo Bot mới.

* Truy cập `https://dev.teams.microsoft.com`. Đăng nhập bằng tài khoản có quyền truy cập Azure Active Directory.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image365.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=63c434f0f543eca558dbcd16af3d6987" alt="Image365" width="479" height="332" data-path="images/image365.png" />

* Vào menu **Tools > Bot management**.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image366.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=5b8d5f9c3b10082e71049a75c85e72ef" alt="Image366" width="1473" height="419" data-path="images/image366.png" />

* Nhấn **Create your first bot**.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image367.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=aa8ad48bc11308cd7d68bc4c1c6de34a" alt="Image367" width="1441" height="564" data-path="images/image367.png" />

* Đặt tên cho Bot, nhấn **Add**.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image368.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=7384be686df5dbd0fc8c9aa1dc0dfe1d" alt="Image368" width="1560" height="658" data-path="images/image368.png" />

* Sau khi tạo, Bot sẽ hiển thị trong danh sách Bot tại mục **Bot management**.

***

**Bước 2**: Tạo một ứng dụng (app) mới trên Microsoft Teams

* Chọn **Apps > Create your first app**.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image369.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=a73fad29f6b7daee3efc96cd8181eb44" alt="Image369" width="1257" height="489" data-path="images/image369.png" />

* Đặt tên cho ứng dụng, nhấn **Add**.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image370.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=81cc177e3d01dc6613a43c8345f1356d" alt="Image370" width="1253" height="511" data-path="images/image370.png" />

* Sau khi tạo, ứng dụng mới tạo sẽ hiển thị trong danh sách Apps.

***

**Bước 3**: Thêm Bot vào ứng dụng

* Truy cập `https://dev.teams.microsoft.com`, chọn mục **Apps**, sau đó chọn ứng dụng cần thêm Bot.
* Chọn mục **Configure > App Features**, nhấn vào **Bot** để bắt đầu thêm Bot vào ứng dụng.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image371.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=0e5fdf283320d1ae869371f5cb530648" alt="Image371" width="1271" height="608" data-path="images/image371.png" />

Bạn có 2 lựa chọn:

* **Lựa chọn 1 — Select an existing bot**: Chọn từ danh sách các Bot đã tạo.
* **Lựa chọn 2 — Enter a bot ID**: Nhập Bot ID thủ công (Thông tin Bot ID xem tại `https://dev.teams.microsoft.com/bots`).

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image372.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=fcae48989343de43264b57eaed0840e2" alt="Image372" width="1299" height="588" data-path="images/image372.png" />

* Cấu hình phạm vi hoạt động và các quyền cho Bot, chọn **Save** để lưu thông tin.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image373.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=b0419ce83a4e3e6884f21eb45786092a" alt="Image373" width="1294" height="589" data-path="images/image373.png" />

***

**Bước 4**: Tích hợp Bot của Microsoft Teams vào nền tảng AI Agents

**Lấy Webhook URL từ AI Agents:**

* Truy cập `https://agents.fpt.ai/bots`, chọn Agent cần tích hợp.
* Vào Menu **Triển khai > Tích hợp kênh chat**, chọn **Microsoft Teams**, sao chép **Webhook URL**.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image374.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=c69c333d3638f15eb180d4687143f421" alt="Image374" width="533" height="387" data-path="images/image374.png" />

* Tại trang `https://dev.teams.microsoft.com/bots`, chọn Bot cần tích hợp.
* Chọn **Configure**, dán Webhook URL đã sao chép từ AI Agents vào trường **Bot endpoint address**.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image375.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=21d83973921118dde3e19cd23671228b" alt="Image375" width="1280" height="261" data-path="images/image375.png" />

**Điền ID ứng dụng và Mật khẩu ứng dụng vào thông tin của AI Agent:**

* Trong Bot, chọn mục **Client secrets**, chọn **Add a secret** để tạo mới.
* Sao chép **Client secrets** và dán vào mục **Mật khẩu ứng dụng** trên AI Agent.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image376.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=06d9f5148aa1c092b4384e9693a12322" alt="Image376" width="1280" height="257" data-path="images/image376.png" />

* Lấy **Bot ID** (xem tại `https://dev.teams.microsoft.com/bots`) và dán vào trường **ID ứng dụng** trên AI Agent.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image377.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=2fd49d169039dd623337ab8a049db20d" alt="Image377" width="1110" height="396" data-path="images/image377.png" />

**Lấy ID của tổ chức:**

* Truy cập [https://portal.azure.com/](https://portal.azure.com/) và đăng nhập vào tài khoản của tổ chức.
* Chọn **View** trong phần **Manage Microsoft Entra ID**.

<img src="https://mintcdn.com/fpt-62e894b4/ESCBKViuW3kOQE7D/images/image-(18).png?fit=max&auto=format&n=ESCBKViuW3kOQE7D&q=85&s=9041fabc9ac475fe9523623fa6f36851" alt="Image (18)" width="936" height="441" data-path="images/image-(18).png" />

<Note>
  Tài khoản của bạn cần có quyền Admin mới truy cập được.
</Note>

* Trong tab **Overview** → **Basic Information**, chọn **Tenant ID** và sao chép.

<img src="https://mintcdn.com/fpt-62e894b4/ESCBKViuW3kOQE7D/images/Screenshot-showing-the-option-to-copy-a-tenant-ID-in-the-Azure-portal_.png?fit=max&auto=format&n=ESCBKViuW3kOQE7D&q=85&s=e960ef25534b9a296833792a114782d5" alt="Screenshot Showing The Option To Copy A Tenant ID In The Azure Portal" width="526" height="227" data-path="images/Screenshot-showing-the-option-to-copy-a-tenant-ID-in-the-Azure-portal_.png" />

* Dán vào phần **ID tổ chức** trên AI Agent.

<img src="https://mintcdn.com/fpt-62e894b4/ESCBKViuW3kOQE7D/images/image-(19).png?fit=max&auto=format&n=ESCBKViuW3kOQE7D&q=85&s=6f9a7addf601bac35f2006bba9103fe5" alt="Image (19)" width="527" height="453" data-path="images/image-(19).png" />

* Sau khi điền xong ID ứng dụng, Mật khẩu ứng dụng, ID tổ chức, chọn **Kết nối** trên AI Agent.

<img src="https://mintcdn.com/fpt-62e894b4/ESCBKViuW3kOQE7D/images/image-(20).png?fit=max&auto=format&n=ESCBKViuW3kOQE7D&q=85&s=73dcce2b257cd7b3edb71503587b37d0" alt="Image (20)" width="527" height="453" data-path="images/image-(20).png" />

***

**Bước 5**: Kiểm thử ứng dụng

**Cách 1: Sử dụng Preview in Teams**

* Truy cập `https://dev.teams.microsoft.com`, chọn ứng dụng cần kiểm thử.
* Chọn **Preview in Teams**.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image379.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=6a92b17c262783a0f6105516e55a0bbf" alt="Image379" width="1189" height="561" data-path="images/image379.png" />

* Chọn **Open Microsoft Teams** để mở cửa sổ chat.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image380.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=c656f13d0ad8319b74087a59edb9c78e" alt="Image380" width="1214" height="457" data-path="images/image380.png" />

* Nhấn **Open** để mở app.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image381.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=3cc45cc9281e4cd60536a3c069d4831b" alt="Image381" width="1574" height="590" data-path="images/image381.png" />

* Tiếp tục nhấn **Open** để chat 1-1 hoặc **Select a channel** để chat với nhóm.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image382.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=831e8bb3a3893a6bb90c830d74801709" alt="Image382" width="1010" height="1378" data-path="images/image382.png" />

**Cách 2: Tải ứng dụng thủ công lên Microsoft Teams**

* Truy cập `https://dev.teams.microsoft.com`, chọn ứng dụng cần xuất bản.
* Tại mục **Publish**, chọn **Publish to Store** và nhấn **Download app package** để tải ứng dụng dưới dạng file zip.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image383.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=2714714658c4778c9cfd88e35ed53a1b" alt="Image383" width="1166" height="545" data-path="images/image383.png" />

* Mở ứng dụng Microsoft Teams:
  * Vào **Apps > Manage your apps > Upload an app > Upload a custom app**.
  * Tải lên file package vừa tải ở bước trên.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image384.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=a09d6fd2565a43ea07f92bacab8d9fc0" alt="Image384" width="1153" height="893" data-path="images/image384.png" />

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image385.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=edbcdfea976fc51841e3814531cf31f6" alt="Image385" width="585" height="352" data-path="images/image385.png" />

* Nhấn **Open** để mở app, sau đó tiếp tục nhấn **Open** để chat 1-1 hoặc **Select a channel** để chat với nhóm.

***

**Bước 6**: Phát hành ứng dụng

Để phát hành ứng dụng cho toàn bộ tổ chức, thực hiện như sau:

* Truy cập `https://dev.teams.microsoft.com`, chọn ứng dụng cần phát hành.
* Tại menu **Publish**, chọn **Publish to your org**.
* Yêu cầu phát hành sẽ được gửi đến **IT Admin** của tổ chức để phê duyệt.
* Sau khi được phê duyệt, ứng dụng sẽ khả dụng cho tất cả người dùng trong tổ chức trên Microsoft Teams.

<img src="https://mintcdn.com/fpt-62e894b4/34cYAT85AD9la3e8/images/image386.png?fit=max&auto=format&n=34cYAT85AD9la3e8&q=85&s=1b368eebda30a1163629b730d0a8c2a2" alt="Image386" width="719" height="500" data-path="images/image386.png" />
