查询外部聊天记录列表

获取外部聊天记录列表。

请求 URL

GET {base_url}/{api_path}/external_chat_logs/list?access_token={access_token}

请求参数

参数 是否必填 类型 说明
channel_type 否 String 渠道类型。

取值范围:

  • all:所有渠道类型。
  • sms:SMS 渠道。
  • whatsapp:WhatsApp。
  • facebook:Facebook。
  • livechat:在线咨询。
cnv_id 否 String 外部聊天会话的唯一 ID。
注: 可通过 查询外部聊天记录列表 接口查询外部聊天会话的 ID。
current_handler 否 String 当前会话处理人。
did_number 否 String 渠道号码。
from 否 String 消息发送方。
is_dealtwith 否 String 会话的处理状态。

取值范围:

  • 0:未处理。
  • 1:已处理。
  • 2:全部状态。
only_deleted_handler 否 String 是否包含由已删除的分机或队列处理的会话。

取值范围:

  • 0:禁用。
  • 1:启用。
order_by 否 String 定义显示顺序。

取值范围:

  • desc:降序。
  • asc:升序。
page 否 Integer 定义显示第几个页面。
page_size 否 Integer 定义每页显示几项查询结果。
sort_by 否 String 定义排序字段。

取值范围:

  • id:按会话 ID 排序。
  • time:按创建时间排序。
  • last_active_time:按最后活跃时间排序。
  • channel_type:按渠道类型排序。
  • did_number:按渠道号码排序。
time_begin 否 String 时间范围的开始时间。
注: 填写的时间格式取决于 PBX 的日期和时间显示格式 (在 PBX 上的 系统 > 日期和时间 > 显示格式 中设置)。
示例:
  • PBX 的 日期显示格式 为 月/日/年,时间显示格式 为 24 小时制,则此参数的有效时间填写格式为 MM/DD/YYYY HH:mm:ss。
  • PBX 的 日期显示格式 为 年/月/日,时间显示格式 为 12 小时制,则此参数的有效时间填写格式为 YYYY/MM/DD HH:mm:ss AM/PM。
time_end 否 String 时间范围的结束时间。
注: 填写的时间格式取决于 PBX 的日期和时间显示格式 (在 PBX 上的 系统 > 日期和时间 > 显示格式 中设置)。
示例:
  • PBX 的 日期显示格式 为 月/日/年,时间显示格式 为 24 小时制,则此参数的有效时间填写格式为 MM/DD/YYYY HH:mm:ss。
  • PBX 的 日期显示格式 为 年/月/日,时间显示格式 为 12 小时制,则此参数的有效时间填写格式为 YYYY/MM/DD HH:mm:ss AM/PM。
time_type 否 String 时间类型。

取值范围:

  • time:会话创建时间。
  • last_active_time:会话最后活跃时间。
to 否 String 消息接收方。

响应参数

参数 类型 说明
errcode Integer 返回错误码。
  • 0:请求成功。
  • 非零值:请求失败。
注: 更多错误码和错误信息说明,请参见 错误码 & 错误信息。
errmsg String 返回信息。
  • SUCCESS:请求成功。
  • FAILURE:请求失败。
conversation_list Array<External_Chat_Logs_Conversation> 外部聊天会话列表。
total_number Integer 外部聊天会话总数。
External_Chat_Logs_Conversation
参数 类型 说明
cnv_id Integer 会话的唯一 ID。
cnv_gid String 会话的全局 ID。
time String 会话创建时间。
from Object<External_Chat_Participant> 会话发送方。
to Object<External_Chat_Participant> 会话接收方。
channel_type String 会话的渠道类型。
  • sms:短信。
  • whatsapp:WhatsApp。
  • facebook:Facebook。
  • livechat:在线咨询。
did_number String 会话使用的渠道号码。
last_active_time String 会话最后活跃时间。
current_handler Object<External_Chat_Participant> 当前会话处理人。
is_dealtwith Integer 会话的处理状态。
  • 0:未处理。
  • 1:已处理。
External_Chat_Participant
参数 类型 说明
type String 参与者类型。
  • extension:分机。
  • queue:队列。
  • external:外部联系人。
name String 参与者的名称。
ext_num String 参与者的分机号码。
external_num String 参与者的外部号码。
is_deleted Boolean 参与者是否已被删除。
  • true:参与者已被删除。
  • false:参与者未被删除。

示例

请求示例

GET /openapi/v1.0/external_chat_logs/list?channel_type=all&is_dealtwith=2&page=1&page_size=2&access_token=xVx9wX2B38gSD0C2o4y9b9bd5QOPz2MK HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com

响应示例

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "total_number": 27,
    "conversation_list": [
        {
            "cnv_id": 27,
            "cnv_gid": "737cbec06e0541dfbfe3768d1ada4f8a",
            "time": "2026/08/22 23:06:43",
            "from": {
                "type": "external",
                "name": "Website Visitor",
                "external_num": "4f6909cf98294dadb3050219c0be217f"
            },
            "to": {
                "type": "extension",
                "name": "Sarah",
                "ext_num": "3200"
            },
            "channel_type": "livechat",
            "did_number": "LC00000",
            "last_active_time": "2026/08/23 23:06:46",
            "is_dealtwith": 1,
            "current_handler": {
                "type": "extension",
                "name": "Sarah",
                "ext_num": "3200"
            }
        },
        {
            "cnv_id": 26,
            "cnv_gid": "82e53eb2de90467f92b730a6b4ce06ad",
            "time": "2026/08/12 08:19:57",
            "from": {
                "type": "external",
                "name": "Website Visitor",
                "external_num": "8eaeff9a383e4175ad276383f4e2c310"
            },
            "to": {
                "type": "extension",
                "name": "Sarah",
                "ext_num": "3200"
            },
            "channel_type": "livechat",
            "did_number": "LC00000",
            "last_active_time": "2026/08/13 08:20:20",
            "is_dealtwith": 1,
            "current_handler": {
                "type": "extension",
                "name": "Sarah",
                "ext_num": "3200"
            }
        }
    ]
}