获取对话列表
获取对话列表
获取指定时间范围内所有对话 ID 的列表。
请求方式
GET
调用地址
https://api.gptbots.cn/v1/bot/conversation/page
调用验证
详情参见 API 概述的鉴权方式说明。
请求
请求示例
curl --location 'https://api.gptbots.cn/v1/bot/conversation/page?page=1&conversation_type=API&start_time=1691942400000&end_time=1699868066999&page_size=50&user_id=1234567890' \
--header 'Authorization: Bearer your_apikey' \
--header 'Content-Type: application/json'
curl --location 'https://api.gptbots.cn/v1/bot/conversation/page?page=1&conversation_type=API&start_time=1691942400000&end_time=1699868066999&page_size=50&user_id=1234567890' \
--header 'Authorization: Bearer your_apikey' \
--header 'Content-Type: application/json'
此代码块在浮窗中显示
请求头
| 字段 | 类型 | 描述 |
|---|---|---|
| Authorization | Bearer ${token} | 使用 Authorization: Bearer ${token}进行调用验证,请在 API 密钥页面获取密钥作为 token。 |
| Content-Type | application/json | 数据类型,取值为 application/json。 |
请求体
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversation_type | string | 是 | 对话类型。ALL --全部对话IDSPACE--工作空间产生的对话IDAPI--API调用产生的对话IDEMBED--iframe产生的对话IDWIDGET--部件气泡产生的对话IDAI_SEARCH--AI搜索产生的对话IDSHARE--分享产生的对话IDWHATSAPP_META--WhatsApp by Meta产生的对话IDWHATSAPP_ENGAGELAB--WhatsApp by EngageLab产生的对话IDDINGTALK--钉钉机器人产生的对话IDDISCORD--Discord产生的对话IDSLACK --Slack产生的对话IDZAPIER--Zapier产生的对话IDWXKF --微信客服产生的对话IDTELEGRAM--Telegram产生的对话IDLIVECHAT--LiveChat产生的对话IDZAPIER--Zapier产生的对话ID |
| user_id | string | 否 | User ID。若不填写,则视为不限制。 |
| start_time | long | 是 | 最近对话时间(开始),时间戳。 |
| end_time | long | 是 | 最近对话时间(结束),时间戳。 |
| page | int | 是 | 页码数,即需要请求第几页,从 1 开始。 |
| page_size | int | 是 | 每页的数据量,范围 1-100。 |
响应
响应示例
{
"list": [
{
"conversation_id": "AaACmo05Yrqb6bOSTbsg",
"user_id": "3",
"recent_chat_time": 1694572952383,
"subject": "2+3=?",
"conversation_type": "API",
"message_count": 2,
"cost_credit": 0.01,
"bot_id": "64b902a84f1ff25d1c60c10b"
},
{
"conversation_id": "64ec1508c9c1ed5605e6ff28",
"user_id": "33",
"recent_chat_time": 1693194862160,
"subject": "Hello!",
"conversation_type": "API",
"message_count": 20,
"cost_credit": 0.59,
"bot_id": "64b902a84f1ff25d1c60c10b"
}
],
"total": 2
}
{
"list": [
{
"conversation_id": "AaACmo05Yrqb6bOSTbsg",
"user_id": "3",
"recent_chat_time": 1694572952383,
"subject": "2+3=?",
"conversation_type": "API",
"message_count": 2,
"cost_credit": 0.01,
"bot_id": "64b902a84f1ff25d1c60c10b"
},
{
"conversation_id": "64ec1508c9c1ed5605e6ff28",
"user_id": "33",
"recent_chat_time": 1693194862160,
"subject": "Hello!",
"conversation_type": "API",
"message_count": 20,
"cost_credit": 0.59,
"bot_id": "64b902a84f1ff25d1c60c10b"
}
],
"total": 2
}
此代码块在浮窗中显示
成功响应
| 字段 | 类型 | 描述 |
|---|---|---|
| list | JSON Array | 对话列表。 |
| conversation_id | string | 对话 ID。 |
| user_id | string | 用户 ID。 |
| recent_chat_time | long | 最近对话时间。 |
| subject | string | 对话主题。 |
| conversation_type | string | 对话类型。 |
| message_count | int | 对话内的消息总数。 |
| cost_credit | float | 对话的消耗积分数。 |
| bot_id | string | Agent ID。 |
| total | int | 返回的对话数。 |
失败响应
| 字段 | 类型 | 描述 |
|---|---|---|
| code | int | 错误码 |
| message | string | 错误详情 |
错误码
| Code | Message |
|---|---|
| 40000 | 参数错误 |
| 20059 | Agent 已删除 |
