Skip to main content

功能说明

查询历史消息与客户端获取历史消息功能一致,用于开发者服务端查询指定人指定会话的历史消息。

请求说明

请求鉴权:接口需要增加验证 Header,请查看 鉴权说明

请求类型GET

请求限频100次/秒

请求地址:https://请求域名/apigateway/hismsgs/query

Content-Typeapplication/json

请求参数

参数数据类型是否必填参数说明
from_idstring单聊会话时,会话一方用户的id
target_idstring单聊会话时,会话另一方用户的id;群聊会话时,群id
channel_typeint会话类型,1:单聊;2:群聊
startint查询历史消息时的开始时间戳
countint分页查询,一页条数,默认20,最大不超过50
orderint查询历史消息时的顺序,0:按时间倒序(默认);1:按时间正序

请求示例

GET /apigateway/hismsgs/query?from_id=xxx&target_id=xxx&channel_type=1&start=xxxx&count=xx HTTP/1.1
appkey: appkey
signature: 2e639ae3600a4sdff61fb88b76f485b
nonce: nonce
timestamp: 1672568121910
Content-Type: application/json

响应示例

{
"code":0,
"msg":"sucess",
"data":{
"msgs":[
{
"sender_id":"xxx",
"receiver_id":"xxx",
"channel_type":1,
"msg_id":"xxxxx",
"msg_time":1321122121223,
"msg_type":"xxx",
"msg_content":"xxxxxx"
}
],
"is_finished":false
}
}