获取对话列表
最新更新:2023-11-15

获取对话列表

获取指定时间范围内所有对话 ID 的列表。

请求方式

GET

调用地址

https://api.gptbots.ai/v1/bot/conversation/page

调用验证

详情参见 API 概述的鉴权方式说明。

请求

请求示例

curl --location 'https://www.gptbots.ai/v1/bot/conversation/page?page=1&conversation_type=API&start_time=1691942400000&end_time=1699868066999&page_size=444&user_id=1234567890' \ --header 'Authorization: Bearer your_apikey' \ --header 'Content-Type: application/json'
          curl --location 'https://www.gptbots.ai/v1/bot/conversation/page?page=1&conversation_type=API&start_time=1691942400000&end_time=1699868066999&page_size=444&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:全部
  • SPACE:工作空间
  • API:BOTAPI 调用
  • EMBED:iframe/气泡小部件
  • SHARE:分享
  • WHATSAPP_META:WhatsApp by Meta
  • WHATSAPP_ENGAGELAB:WhatsApp by EngageLab
  • DINGTALK:钉钉机器人
  • Discord:DISCORD
  • Slack:SLACK
  • Zapier:ZAPIER
  • 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 Bot ID。
    total int 返回的对话数。

    失败响应

    字段 类型 描述
    code int 错误码
    message string 错误详情

    错误码

    Code Message
    40000 参数错误
    20059 Bot 已删除