> 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/tech/serve/customer-service-system-integration/genesys-cloud-integration.md). Agents can also search and read this documentation through its [MCP server](https://docs.maiagent.ai/~gitbook/mcp).

# Genesys Cloud 整合

以 Genesys Cloud Open Messaging 串接 MaiAgent 對話平台：架構、OAuth 憑證與 API、訊息雙向流向、簽章驗證、錯誤處理與限制

本頁寫給要把 MaiAgent 對話平台接上 **Genesys Cloud** 的串接開發者與客戶 IT。整合走 Genesys Cloud 的 **Open Messaging**：訪客在 MaiAgent 的對話平台（Web Chat、LINE 等）對話，MaiAgent 把訊息即時送進 Genesys Cloud，Genesys Cloud 端（客服人員或 bot）的回覆再送回 MaiAgent，由 MaiAgent 轉給訪客。

這是[第三方客服系統串接](https://docs.maiagent.ai/tech/serve/customer-service-system-integration.md)「情境 B」（訪客在 MaiAgent 對話平台、客服在您的系統）的內建版本：MaiAgent 已內建 Genesys Cloud 的訊息格式、OAuth 換 Token 與簽章驗證，不需要自己寫轉接程式。

後台逐步操作（在哪裡填欄位、按哪個按鈕）見使用者手冊的 [Webhook › Genesys Cloud 整合](https://docs.maiagent.ai/build/conversation-settings/webhook#genesys-cloud-integration)；本頁說明背後的協定、API 與行為。

API 的欄位名稱為 camelCase；下方 API 範例以 `https://api.maiagent.ai/api/v1/` 為基底網址，認證方式見[快速上手](https://docs.maiagent.ai/tech/api-integration/quickstart.md)。

## 串接架構 <a href="#architecture" id="architecture"></a>

```mermaid
sequenceDiagram
    participant V as 訪客
    participant M as MaiAgent 對話平台
    participant G as Genesys Cloud

    V->>M: 發送訊息
    M->>G: Incoming Webhook（Genesys 格式）<br/>POST …/inbound/open/message
    M-->>V: Agent 回覆
    M->>G: Outgoing Webhook（Genesys 格式）<br/>POST …/inbound/open/receipt
    Note over G: 客服人員或 bot 回覆
    G->>M: Genesys outbound webhook<br/>POST MaiAgent 接收網址（X-Hub-Signature-256）
    M-->>V: 轉送回覆給訪客
```

整合由同一個對話平台上的三個設定組成：

| 設定                                                      | 方向                       | 作用                                                                                                                                          |
| ------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **Genesys Cloud 整合**（每個對話平台一組）                          | —                        | 存放區域、Open Messaging Integration ID 與 OAuth Client Credentials。MaiAgent 用它換取 access token、組出 Genesys API 網址；該對話平台底下所有 Genesys 格式的 Webhook 共用 |
| **Incoming／Outgoing Webhook**，Payload 格式選 Genesys Cloud | MaiAgent → Genesys Cloud | 把訪客訊息（Incoming）與 Agent 或真人回覆（Outgoing）送到 Genesys Cloud Open Messaging Inbound API                                                           |
| **Receive Webhook**，Payload 預設格式選 Genesys Cloud         | Genesys Cloud → MaiAgent | 提供一個接收網址，讓 Genesys Cloud 把回覆送回 MaiAgent                                                                                                     |

## 前置準備 <a href="#prerequisites" id="prerequisites"></a>

在 Genesys Cloud 端準備：

1. **Open Messaging 整合**：取得它的 Integration ID（後台說明：Genesys Cloud Admin → Message → Platforms）。
2. **OAuth Client**：授權類型為 Client Credentials，需具備 `conversation:message:create` 權限，取得 Client ID 與 Client Secret。
3. 確認您的 Genesys Cloud 組織所在區域，對照下方[支援區域](#regions)。

在 MaiAgent 端，呼叫下方整合 API 的權限：

* **能存取的對話平台**：組織擁有者可存取組織內所有對話平台；其他成員只能存取透過群組取得存取權的對話平台，且一律不含組織的 MaiGPT 對話平台。存取不到的對話平台回 `404`。
* **寫入**（PUT、DELETE、測試憑證）：另外需要成員具備「對話平台」權限（擁有者在組織方案包含此權限時即具備），沒有時回 `403`。查詢（GET）只需登入。

## Genesys Cloud 整合設定 <a href="#integration-settings" id="integration-settings"></a>

每個對話平台最多一組 Genesys Cloud 整合。

### 欄位 <a href="#integration-fields" id="integration-fields"></a>

| 欄位                           | 類型      | 說明                                                                                                                                       |
| ---------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `region`                     | string  | Genesys Cloud 區域代碼，見[支援區域](#regions)。必填                                                                                                  |
| `integrationId`              | string  | Open Messaging Integration ID，最長 64 字元。必填                                                                                                |
| `clientId`                   | string  | OAuth Client ID，最長 64 字元。必填                                                                                                              |
| `clientSecret`               | string  | OAuth Client Secret。**只能寫入**，任何回應都不回傳；建立時必填，之後修改可省略以沿用原值。加密儲存                                                                            |
| `hasClientSecret`            | boolean | 唯讀，是否已存有 Client Secret                                                                                                                   |
| `tokenStatus`                | string  | 唯讀，access token 狀態：`active`（可用，或尚未取過 token）／`expired`（快取的 token 已過期，下次送出時會自動換新）／`invalidated`（Genesys Cloud 拒絕了這組憑證，需重新輸入 Client Secret） |
| `regionLabel`                | string  | 唯讀，區域顯示名稱                                                                                                                                |
| `id`、`createdAt`、`updatedAt` | —       | 唯讀                                                                                                                                       |

access token 只存在 MaiAgent 內部，不會出現在 API 回應。

### API <a href="#integration-api" id="integration-api"></a>

```bash
# 查詢（未設定時回 200，內容為 null）
GET    https://api.maiagent.ai/api/v1/inboxes/{inboxId}/genesys-cloud-integration/

# 建立或更新（同一個端點）
PUT    https://api.maiagent.ai/api/v1/inboxes/{inboxId}/genesys-cloud-integration/

# 移除（未設定時同樣回 204）
DELETE https://api.maiagent.ai/api/v1/inboxes/{inboxId}/genesys-cloud-integration/

# 測試憑證，不儲存任何資料；成功回 204
POST   https://api.maiagent.ai/api/v1/inboxes/{inboxId}/genesys-cloud-integration/test/
```

```json
{
  "region": "ap-northeast-1",
  "integrationId": "your-open-messaging-integration-id",
  "clientId": "your-oauth-client-id",
  "clientSecret": "your-oauth-client-secret"
}
```

* **PUT 帶了 `clientSecret`**：MaiAgent 會先向 Genesys Cloud 的 `/oauth/token` 以 Client Credentials 換一次 token（逾時 10 秒）驗證憑證，失敗回 `400` 不儲存。驗證通過後清除先前的失效標記與快取的 token。
* **PUT 沒帶 `clientSecret`**（只改區域或 ID）：不重新驗證，沿用原本的 Secret；若整合原本已是 `invalidated`，狀態維持不變，必須輸入新的 Secret 才會恢復。
* **測試端點沒帶 `clientSecret`**：改用已儲存的區域、Client ID 與 Secret 測試，您傳入的 `region`／`clientId` 會被忽略；沒有已儲存的 Secret 時回 `400`。
* **移除整合**：該對話平台底下 Genesys 格式的 Incoming／Outgoing Webhook 從此不會送出（不留推送紀錄），Webhook 設定本身保留。

設定或測試憑證失敗時回 `400`，常見的 `detail` 有下列幾種（依 `Accept-Language` 翻譯）：

| `detail`（英文原文）                                                                              | 原因                                                       |
| ------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| `Unsupported Genesys Cloud region.`                                                         | `region` 不在支援清單（測試端點；PUT 時由欄位驗證先擋下，回欄位錯誤）                |
| `Genesys Cloud rejected the client credentials. Please double-check clientId/clientSecret.` | Genesys Cloud 回 `invalid_client` 或 `unauthorized_client` |
| `Genesys Cloud token endpoint returned an error.`                                           | Genesys Cloud 回其他錯誤狀態                                    |
| `Network error talking to Genesys Cloud`                                                    | 連不上 Genesys Cloud                                        |
| `client_secret is required for new Genesys Cloud integrations.`                             | 建立時沒帶 `clientSecret`                                     |
| `client_secret is required to test credentials.`                                            | 測試端點沒帶 `clientSecret`，且這個對話平台沒有已儲存的 Secret               |

### 支援區域 <a href="#regions" id="regions"></a>

MaiAgent 依區域決定換 token 與送訊息的網域。若您的網路有出站管制，請放行對應的兩個網域。

| `region`         | 顯示名稱                  | 換 token 網域                     | API 網域                       |
| ---------------- | --------------------- | ------------------------------ | ---------------------------- |
| `us-east-1`      | Americas (US East)    | `login.mypurecloud.com`        | `api.mypurecloud.com`        |
| `us-east-2`      | US East 2 (FedRAMP)   | `login.use2.us-gov-pure.cloud` | `api.use2.us-gov-pure.cloud` |
| `us-west-2`      | Americas (US West)    | `login.usw2.pure.cloud`        | `api.usw2.pure.cloud`        |
| `ca-central-1`   | Canada                | `login.cac1.pure.cloud`        | `api.cac1.pure.cloud`        |
| `sa-east-1`      | South America         | `login.sae1.pure.cloud`        | `api.sae1.pure.cloud`        |
| `eu-west-1`      | EMEA (Ireland)        | `login.mypurecloud.ie`         | `api.mypurecloud.ie`         |
| `eu-west-2`      | EMEA (London)         | `login.euw2.pure.cloud`        | `api.euw2.pure.cloud`        |
| `eu-central-1`   | EMEA (Frankfurt)      | `login.mypurecloud.de`         | `api.mypurecloud.de`         |
| `eu-central-2`   | EMEA (Zurich)         | `login.euc2.pure.cloud`        | `api.euc2.pure.cloud`        |
| `ap-northeast-1` | Asia Pacific (Tokyo)  | `login.mypurecloud.jp`         | `api.mypurecloud.jp`         |
| `ap-northeast-2` | Asia Pacific (Seoul)  | `login.apne2.pure.cloud`       | `api.apne2.pure.cloud`       |
| `ap-northeast-3` | Asia Pacific (Osaka)  | `login.apne3.pure.cloud`       | `api.apne3.pure.cloud`       |
| `ap-southeast-2` | Asia Pacific (Sydney) | `login.mypurecloud.com.au`     | `api.mypurecloud.com.au`     |
| `ap-south-1`     | Asia Pacific (Mumbai) | `login.aps1.pure.cloud`        | `api.aps1.pure.cloud`        |
| `me-central-1`   | Middle East (UAE)     | `login.mec1.pure.cloud`        | `api.mec1.pure.cloud`        |

## 設定 Webhook <a href="#webhooks" id="webhooks"></a>

Webhook 的共通欄位與管理 API（`/inboxes/{inboxId}/webhooks/`）見 [Webhook › 以 API 管理 Webhook](https://docs.maiagent.ai/tech/serve/webhook.md#manage-by-api)。Genesys Cloud 用到的設定如下。

### MaiAgent → Genesys Cloud：Incoming／Outgoing <a href="#outbound-webhooks" id="outbound-webhooks"></a>

```json
{
  "name": "訪客訊息送 Genesys Cloud",
  "direction": "incoming",
  "isEnabled": true,
  "templatePreset": "genesys_cloud"
}
```

* `templatePreset` 設為 `genesys_cloud`，`url` 可以不填：送出時一律依整合設定組出網址，不使用 `url` 欄位的值。
* 送出時 MaiAgent 自動帶 `Authorization: Bearer <access token>`，不必在 `headers` 自己放 token。
* 依方向送到 Genesys Cloud Open Messaging Inbound API 的不同端點：

| `direction` | 送出的訊息                     | 送到                                                                                    |
| ----------- | ------------------------- | ------------------------------------------------------------------------------------- |
| `incoming`  | 訪客訊息                      | `https://{API 網域}/api/v2/conversations/messages/{integrationId}/inbound/open/message` |
| `outgoing`  | Agent 或真人客服在 MaiAgent 的回覆 | `https://{API 網域}/api/v2/conversations/messages/{integrationId}/inbound/open/receipt` |

* `genesys_cloud` 格式只能用在 `incoming`／`outgoing`，用在 `receive` 會回 `400`。
* 對話平台還沒設定 Genesys Cloud 整合時，這類 Webhook 不會送出，也不留推送紀錄。

### Genesys Cloud → MaiAgent：Receive <a href="#receive-webhook" id="receive-webhook"></a>

```json
{
  "name": "接收 Genesys Cloud 回覆",
  "direction": "receive",
  "isEnabled": true,
  "payloadPreset": "genesys_cloud",
  "secretToken": "與 Genesys Cloud 共用的簽章密鑰"
}
```

* `payloadPreset` 與 `secretToken` 都必填，缺少時回 `400`；`secretToken` 只能寫入，查詢時不回傳。
* 建立後，查詢這筆 Webhook 的回應會帶 `receiveUrl`，格式為 `https://<MaiAgent 網域>/api/webhooks/inbox/{inboxId}/{webhookId}/`。到 Genesys Cloud 的 Open Messaging 整合，把 outbound webhook 網址設為 `receiveUrl`，簽章密鑰設為同一組 `secretToken`。

## 訊息格式：MaiAgent 送往 Genesys Cloud <a href="#outbound-payload" id="outbound-payload"></a>

`Content-Type: application/json`，Incoming 與 Outgoing 結構相同，以 `direction` 區分：

```json
{
  "channel": {
    "messageId": "2491074a-6d23-4289-af45-caa12531420e",
    "type": "Private",
    "time": "2026-10-12T02:15:30.123456+00:00",
    "to": { "id": "1f9c1c1e-4d1a-4b1e-9d0e-7b2f4a5c6d7e" },
    "from": {
      "id": "c0ffee00-1111-2222-3333-444455556666",
      "idType": "opaque",
      "firstName": "王小明",
      "lastName": ""
    }
  },
  "type": "Text",
  "text": "我想查詢訂單狀態",
  "direction": "Inbound",
  "content": [
    {
      "contentType": "Attachment",
      "attachment": {
        "mediaType": "Image",
        "url": "https://example.com/photo.jpg",
        "mime": "image/jpeg",
        "filename": "photo.jpg"
      }
    }
  ]
}
```

| 欄位                       | 內容                                                                                                                                                           |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `channel.messageId`      | MaiAgent 訊息 ID                                                                                                                                               |
| `channel.time`           | 訊息建立時間（ISO 8601）                                                                                                                                             |
| `channel.to.id`          | MaiAgent 對話平台 ID                                                                                                                                             |
| `channel.from.id`        | MaiAgent 聯絡人 ID（訪客）。**Genesys Cloud 回覆時會把這個 ID 帶回來，MaiAgent 靠它找到要回覆的訪客**                                                                                     |
| `channel.from.idType`    | 聯絡人有 Email 時為 `email`，否則為 `opaque`                                                                                                                           |
| `channel.from.firstName` | 聯絡人名稱；`lastName` 一律為空字串                                                                                                                                      |
| `text`                   | 訊息文字；只有附件、沒有文字的訊息為空字串                                                                                                                                        |
| `direction`              | Incoming Webhook 為 `Inbound`，Outgoing Webhook 為 `Outbound`                                                                                                   |
| `content[]`              | 只在有附件時出現。`mediaType` 對應：圖片與貼圖為 `Image`、影片為 `Video`、音訊為 `Audio`、其他為 `File`；`url` 優先使用 MaiAgent 儲存的檔案網址，沒有時用來源網址；`mime` 依檔名推測，推測不到為 `application/octet-stream` |

## 訊息格式：Genesys Cloud 送回 MaiAgent <a href="#inbound-payload" id="inbound-payload"></a>

### 簽章驗證 <a href="#receive-signature" id="receive-signature"></a>

MaiAgent 只接受帶正確簽章的請求：標頭 `X-Hub-Signature-256` 必須等於 `sha256=` 加上「以 `secretToken` 為金鑰、對原始 request body 計算的 HMAC-SHA256」的 **Base64** 編碼值（不是十六進位），以固定時間比較。缺標頭、簽章不符或 Webhook 沒有設定 `secretToken`，一律回 `403`。

{% hint style="info" %}
這組簽章由 Genesys Cloud 產生、MaiAgent 驗證，與 MaiAgent 推送時帶的 `X-MaiAgent-Signature-256`（十六進位、含時間戳）是兩套不同機制。
{% endhint %}

### 會被處理的內容 <a href="#receive-parsing" id="receive-parsing"></a>

MaiAgent 從 Genesys Cloud outbound webhook 的 body 讀取：

| 欄位                  | 用途                                                                                                            |
| ------------------- | ------------------------------------------------------------------------------------------------------------- |
| `type`              | 只處理 `Text`；其他類型（例如回條、事件）直接回 `200`，不建立訊息                                                                       |
| `text`              | 回覆文字（去除前後空白）                                                                                                  |
| `content[]`         | `contentType` 為 `Attachment` 且有 `attachment.url` 的項目會建立附件；`mediaType` 為 `Image`／`Video`／`Audio` 對應同類型，其他為一般檔案 |
| `channel.to.id`     | 要回覆的 MaiAgent 聯絡人 ID，也就是先前送出時的 `channel.from.id`                                                              |
| `channel.from`      | 回覆者資訊（`id`、`idType`、`firstName`、`lastName`、`nickname`），存入訊息 `metadata.genesys_from`                           |
| `originatingEntity` | 回覆來源（例如 `Human`、`Bot`），存入訊息 `metadata.originating_entity`                                                     |
| `id`                | Genesys Cloud 訊息 ID，用來去重                                                                                      |

文字與附件都沒有、或缺少 `channel.to.id` 時，回 `200` 且不建立訊息。

### 寫入對話與轉送訪客 <a href="#receive-delivery" id="receive-delivery"></a>

1. 以 `channel.to.id` 在這個對話平台找聯絡人，再取該聯絡人在此對話平台**最近有訊息的那個對話**。找不到聯絡人或對話時回 `200`，不建立訊息。
2. 相同 Genesys 訊息 `id` 已寫入過就略過，Genesys Cloud 重送不會造成重複訊息。
3. 建立一則回覆訊息（Outgoing），發送者為對話平台綁定的 Agent；對話平台沒有綁定 Agent 時，改用對話平台的建立者。要分辨這則回覆來自 Genesys 的真人或 bot，請讀 `metadata.originating_entity`。
4. 訊息透過訪客所在的對話平台送出，和 MaiAgent 其他回覆走同一條送出流程。有附件時先下載附件再送出；個別附件下載失敗，文字與其他附件仍照常送出。
5. 這則訊息**不會**再觸發該對話平台的 Outgoing Webhook，避免同一則回覆又被送回 Genesys Cloud。

## 與轉真人的關係 <a href="#handoff" id="handoff"></a>

Incoming Webhook 會推送該對話平台的**每一則**訪客訊息，不論對話目前由 Agent 還是真人處理；Outgoing Webhook 推送 Agent 與 MaiAgent 後台真人客服的回覆。兩個方向都設定時，Genesys Cloud 端看得到完整對話。

對話是否由 Agent 自動回覆，仍由 MaiAgent 對話的轉真人狀態決定（`auto_reply_enabled`）。轉真人條件、何時轉回 AI，以及以 API 呼叫 `return-to-ai`，見[第三方客服系統串接（含轉真人）](https://docs.maiagent.ai/tech/serve/customer-service-system-integration.md#scenario-b)與使用者手冊的[客服轉真人設定](https://docs.maiagent.ai/build/conversation-settings/human-handoff)。

## 錯誤處理 <a href="#error-handling" id="error-handling"></a>

### MaiAgent 送往 Genesys Cloud <a href="#outbound-errors" id="outbound-errors"></a>

| 情況                                                               | 行為                                                                                                           |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| access token 快取中、距到期超過 60 秒                                      | 直接使用                                                                                                         |
| 沒有 token 或 60 秒內到期                                               | 送出前先向 Genesys Cloud 換新 token（逾時 10 秒）                                                                        |
| Genesys Cloud API 回 `401`                                        | 立即強制換新 token 並重送一次，不占自動重送額度；仍是 `401` 則停止                                                                     |
| 換 token 時 Genesys Cloud 回 `invalid_client`／`unauthorized_client` | 整合標記為失效（`tokenStatus: invalidated`），該則訊息放棄；之後所有 Genesys 格式的 Webhook 都暫停送出、不留推送紀錄，直到以 PUT 重新輸入 `clientSecret` |
| 逾時、連線失敗、`5xx`、`429`                                              | 依 [Webhook › 自動重送](https://docs.maiagent.ai/tech/serve/webhook.md#retry)：約 1、5、15 分鐘後各重送一次                   |
| 其他 `4xx`                                                         | 記錄為失敗，不重送                                                                                                    |

每次送出的請求與回應都留有推送紀錄（標頭已遮罩），檢視位置見 [Webhook › 傳送行為](https://docs.maiagent.ai/tech/serve/webhook.md#delivery)。

### Genesys Cloud 送回 MaiAgent <a href="#inbound-errors" id="inbound-errors"></a>

| 回應                                       | 情況                                                        |
| ---------------------------------------- | --------------------------------------------------------- |
| `404`                                    | Webhook 不存在、已停用、不是 `receive` 類型，或網址中的對話平台 ID 與 Webhook 不符 |
| `403` `{"detail": "Invalid signature."}` | 簽章缺漏或不符，或 Webhook 沒有設定 `secretToken`                      |
| `200`                                    | 驗證通過。包含已成功寫入，以及上方列出的略過情況（非 `Text`、無內容、找不到聯絡人或對話、重複訊息）     |
| `200`                                    | 處理過程發生錯誤（例如 body 不是合法 JSON）。MaiAgent 記錄錯誤後仍回 `200`        |

{% hint style="warning" %}
簽章通過後，各種略過與內部錯誤都回 `200`。在 Genesys Cloud 端看到送出成功，不代表訪客已收到；請以 MaiAgent 對話紀錄確認。
{% endhint %}

## 限制 <a href="#limitations" id="limitations"></a>

* 每個對話平台只能設定一組 Genesys Cloud 整合，該平台下所有 Genesys 格式的 Webhook 共用。
* 區域限於上方[支援區域](#regions)清單。
* Genesys Cloud 送回的內容只處理 `Text` 類型的文字與附件；其他訊息類型不會出現在對話中。
* 回覆一律寫入該聯絡人在此對話平台最近有訊息的對話；同一位訪客同時有多個對話時，無法指定其他對話。
* Receive 的 Payload 預設格式目前只支援 Genesys Cloud。其他外部平台請改用[第三方客服系統串接](https://docs.maiagent.ai/tech/serve/customer-service-system-integration.md)的 API 寫回方式。

## 相關頁面 <a href="#related" id="related"></a>

* [Webhook › Genesys Cloud 整合](https://docs.maiagent.ai/build/conversation-settings/webhook#genesys-cloud-integration)（使用者手冊）：後台填寫欄位與測試連線
* [Webhook](https://docs.maiagent.ai/tech/serve/webhook.md)：共通欄位、推送紀錄、自動重送與以 API 管理 Webhook
* [第三方客服系統串接（含轉真人）](https://docs.maiagent.ai/tech/serve/customer-service-system-integration.md)：不使用 Genesys Cloud 時，以 API 與 Webhook 自行串接客服系統


---

# 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 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/tech/serve/customer-service-system-integration/genesys-cloud-integration.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 `automate deployments from our CI pipeline` 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.
