根据消息 ID 查询历史消息
POST
/im/v2/conversations/{conversation_id}/batch_messages
请求参数
Path 参数
conversation_id
string
必需
owner_id|conversation_type|other_id 或 owner_id|conversation_type|team_id
owner_id:操作者账号 ID
conversation_type:会话类型,1:单聊会话;2:高级群会话;3:超大群会话
other_id:对方账号 ID(单聊对话)
team_id:群组 ID(群组会话)
Header 参数
AppKey
string
必需
默认值:
{{AppKey}}
X-custom-traceid
string
可选
默认值:
{% mock 'uuid' %}
Nonce
string
必需
默认值:
{{Nonce}}
CurTime
string
必需
默认值:
{{CurTime}}
CheckSum
string
必需
默认值:
{{CheckSum}}
Body 参数application/json
messages
array [object {2}]
需要查询的消息对象。
message_server_id
number
消息的服务器 ID。
create_time
number
消息的发送时间(毫秒)。
示例
{
"messages": [
{
"message_server_id": 0,
"create_time": 0
}
]
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://open.yunxinapi.com/im/v2/conversations//batch_messages' \
--header 'AppKey;' \
--header 'X-custom-traceid: {% mock '\''uuid'\'' %}' \
--header 'Nonce;' \
--header 'CurTime;' \
--header 'CheckSum;' \
--header 'Content-Type: application/json' \
--data-raw '{
"messages": [
{
"message_server_id": 0,
"create_time": 0
}
]
}'
返回响应
🟢200成功
application/json
Body
code
integer
必需
msg
string
必需
data
object
必需
failed_list
array [object {4}]
可选
success_list
array [object {16}]
查询到的消息列表。
示例
{
"code": 0,
"msg": "string",
"data": {
"failed_list": [
{
"message_server_id": 0,
"create_time": 0,
"error_code": 0,
"error_msg": "string"
}
],
"success_list": [
{
"message_server_id": 0,
"conversation_type": 0,
"sender_id": "string",
"message_type": 0,
"create_time": 0,
"message_client_id": "string",
"sender_client_type": 0,
"text": "string",
"attachment": {},
"extension": "string",
"team_id": 0,
"receiver_id": "string",
"sub_type": 0,
"modify_account_id": "string",
"modify_time": 0,
"thread_config": {
"thread_root": {
"sender_id": "string",
"receiver_id": "string",
"create_time": 0,
"message_server_id": "string",
"message_client_id": "string"
},
"thread_reply": {
"sender_id": "string",
"receiver_id": "string",
"create_time": 0,
"message_server_id": "string",
"message_client_id": "string"
}
}
}
]
}
}
🟢200成功
🟢200请求参数错误
🟢200服务器错误