logo
開發者文件
搜尋
獲取對話列表

獲取對話列表

根據指定的篩選條件,檢索代理的所有對話資訊,包括 conversation_iduser_id、最近聊天時間、對話主題、對話類型、總訊息數量,以及點數消耗。

請求方法

GET

請求 URL

https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page

請求驗證

請參考 API 總覽 以瞭解驗證指引。

請求

請求範例

curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page?page=1&conversation_type=ALL&start_time=1691942400000&end_time=1699868066999&page_size=50&user_id=1234567890' \ -H 'Authorization: Bearer ${API Key}' \
                      
                      curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/conversation/page?page=1&conversation_type=ALL&start_time=1691942400000&end_time=1699868066999&page_size=50&user_id=1234567890'  \
-H 'Authorization: Bearer ${API Key}' \

                    
此代碼塊在浮窗中顯示

請求標頭

欄位 類型 描述
Authorization Bearer ${API Key} 使用 Authorization: Bearer ${API Key} 進行驗證。API 金鑰可從 API 金鑰頁取得。

請求參數

欄位 類型 必填 描述
conversation_type string 對話類型的來源。可設為:ALLAPIEMBED 及其他來源類型。
user_id string 使用者 ID。若未填寫,則無限制。
start_time long 最近對話的開始時間,需使用時間戳格式。
end_time long 最近對話的結束時間,需使用時間戳格式。
page int 頁碼,表示請求的頁數,從第 1 頁開始。
page_size int 每頁的資料筆數,範圍 10-100。

注意:關於 conversation_type 的可能值,請參考 使用者總覽 表格中的 Conversation ID (conversation_id) 來源欄位值列表

回應

回應範例

{ "list": [ { "conversation_id": "AaACmo05Yrqb6bOSTbsg", "user_id": "3", "anonymous_id": "202607000198150", "recent_chat_time": 1694572952383, "subject": "2+3=?", "conversation_type": "API", "source_page": null, "message_count": 2, "cost_credit": 0.01, "bot_id": "64b902a84f1ff25d1c60c10b", "quality_score": null }, { "conversation_id": "64ec1508c9c1ed5605e6ff28", "user_id": "33", "anonymous_id": "202607000198151", "recent_chat_time": 1693194862160, "subject": "Hello!", "conversation_type": "LIVECHAT", "source_page": "https://www.livechat.com/", "message_count": 20, "cost_credit": 0.59, "bot_id": "64b902a84f1ff25d1c60c10b", "quality_score": null } ], "total": 2 }
                      
                      {
  "list": [
    {
      "conversation_id": "AaACmo05Yrqb6bOSTbsg",
      "user_id": "3",
      "anonymous_id": "202607000198150",
      "recent_chat_time": 1694572952383,
      "subject": "2+3=?",
      "conversation_type": "API",
      "source_page": null,
      "message_count": 2,
      "cost_credit": 0.01,
      "bot_id": "64b902a84f1ff25d1c60c10b",
      "quality_score": null
    },
    {
      "conversation_id": "64ec1508c9c1ed5605e6ff28",
      "user_id": "33",
      "anonymous_id": "202607000198151",
      "recent_chat_time": 1693194862160,
      "subject": "Hello!",
      "conversation_type": "LIVECHAT",
      "source_page": "https://www.livechat.com/",
      "message_count": 20,
      "cost_credit": 0.59,
      "bot_id": "64b902a84f1ff25d1c60c10b",
      "quality_score": null
    }
  ],
  "total": 2
}

                    
此代碼塊在浮窗中顯示

成功回應

欄位 類型 描述
list JSON 陣列 對話列表。
conversation_id string 對話 ID。
user_id string 使用者 ID。透過 LINE、Telegram 等第三方渠道產生的對話該值可能為 null,此時可透過 anonymous_id 識別使用者。
anonymous_id string 匿名 ID,由 GPTBots 根據使用者來源平台自動產生。
recent_chat_time long 最近聊天時間。
subject string 對話主題。
conversation_type string 對話類型。
source_page string 使用者首次訊息的來源網頁。目前僅 LIVECHAT 渠道支援傳輸該欄位,當 conversation_type 不為 LIVECHAT 時,該值為 null。
message_count int 對話中的訊息總數。
cost_credit float 該對話消耗的點數。
bot_id string 代理 ID。
quality_score float 對話品質評分,未評分時為 null。
total int 符合篩選條件的對話總數(並非當前頁返回的筆數)。

錯誤回應

欄位 類型 描述
code int 錯誤代碼。
message string 錯誤詳情。

錯誤代碼

代碼 訊息
40000 無效的參數
20059 代理已刪除
40127 開發者驗證失敗