# 拉取聊天记录

# 请求方式

GET

# 请求地址

https://nbd-api.myscrm.cn/open-nbd-qw-msgaudit/v1/raw-chat-record/pull

# 请求参数

# 示例

https://nbd-api.myscrm.cn/open-nbd-qw-msgaudit/v1/raw-chat-record/pull?app_id=xxx&start_time=1650810127304&end_time=1650810127999&chat_id=xxxx&action=send&msg_types=text,image&asc=true&thumb_option=image/resize,m_fixed,w_100,h_100/rotate,90&page_size=10&cursor=

# 说明

参数 类型 必须 说明
app_id string 企微中台应用 id
start_time uint64 拉取起始时间,毫秒时间戳,默认为拉取近 3 天的聊天数据,与拉取结束时间间隔不能超过 3 天
end_time uint64 拉取结束时间,毫秒时间戳
chat_id string 企微中台聊天 id
action string 消息动作:send-发送,recall-撤回,默认为所有
msg_types string 消息类型:text、image、revoke、agree、disagree、voice、video、card、location、emotion、file、link、chatrecord、todo、vote、collect、redpacket、meeting、docmsg、markdown、news、calendar、mixed、meeting_voice_call、voip_doc_share,voiptext,qydiskfile,类型名称与企微文档 (opens new window)一致
多个消息使用英文逗号拼接,不传或传空字符串即为拉取所有类型的消息
asc bool 是否按发送时间正序,默认为倒序
thumb_option string 缩略图参数,见说明 (opens new window)
page_size uint32 每页记录数,默认为 10,不超过 1000
cursor string 游标,开始拉取时为空

# 返回参数

# 示例

{
  "errcode": 0,
  "errmsg": "ok",
  "encrypted": "加密内容",
  "next_cursor": "xxxxxxxxxxxxxxx"
}

# 说明

参数 类型 说明
encrypted string 加密的聊天记录列表,解密方式与企微回调信息的解密方式 (opens new window)一致,加解密使用的 key 是对应企业的会话存档能力的回调 encoding_aes_key。解密后得到的是对象数组 json 字符串,对象的定义详见获取指定聊天记录接口
next_cursor string 下一页游标,没有更多数据时为空

# 注意事项

  1. 由于从企微拉取文件内容保存到企微中台存在耗时,存在文件的消息记录在拉取到的时候,文件并不一定能够访问。如接入方需下载文件到本地,建议接入方记录相应聊天记录 app_id、chat_record_id 延时轮询获取指定聊天记录接口
  2. 目前 chatrecord、mixed 消息中的文件存在无法访问的问题,正在修复中