Skip to content
POST{BASE_URL}/api/message/sendRead
写操作消息JSON · Bearer 调用凭证 · body appid

标记会话已读 ​

把一个单聊或群聊会话标记为已读。

说明与注意 ​

  • 只能标记为已读;标记未读、清空聊天记录、删除会话不在本接口。
  • 成功时 data 不是空对象,而是这个会话的最后一条消息。
  • 群聊的 roomId 是 17 位以上的 int64,JS 里用 BigInt 或 json-bigint 解析,不要转成 Number。

请求参数 ​

参数必填类型说明
appid是string实例 appid,标识操作哪个已登录账号。示例:we_xxxxxxxxxxxxxxx
conversationId是int64会话 id:单聊传对方 userId,群聊传 roomId,自己的会话传当前账号 uin;必须是 JSON number。示例:1688850000000001
unread否int64可不传;传就传 0,不要传 null。示例:0

请求示例 ​

http
POST {BASE_URL}/api/message/sendRead
Authorization: Bearer <你的调用凭证>
Content-Type: application/json

{
  "appid": "we_xxxxxxxxxxxxxxx",
  "conversationId": 1688850000000001,
  "unread": 0
}
bash
curl -X POST '{BASE_URL}/api/message/sendRead' \
  -H 'Authorization: Bearer <你的调用凭证>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "appid": "we_xxxxxxxxxxxxxxx",
  "conversationId": 1688850000000001,
  "unread": 0
}'
python
import requests

url = "{BASE_URL}/api/message/sendRead"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
  "appid": "we_xxxxxxxxxxxxxxx",
  "conversationId": 1688850000000001,
  "unread": 0
}"""

resp = requests.post(url, headers=headers, data=body.encode("utf-8"))
print(resp.text)
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

String url = "{BASE_URL}/api/message/sendRead";
String body = "{\n" +
    "  \"appid\": \"we_xxxxxxxxxxxxxxx\",\n" +
    "  \"conversationId\": 1688850000000001,\n" +
    "  \"unread\": 0\n" +
    "}";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
    .header("Authorization", "Bearer <你的调用凭证>")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
php
<?php

$url = '{BASE_URL}/api/message/sendRead';
$body = <<<'JSON'
{
  "appid": "we_xxxxxxxxxxxxxxx",
  "conversationId": 1688850000000001,
  "unread": 0
}
JSON;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer <你的调用凭证>',
    'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

响应示例 ​

json
{
  "code": 0,
  "data": {
    "id": 1000458,
    "syncKey": 12729027,
    "messageType": 0,
    "fromUserId": 1688850000000001,
    "toUserId": 1688850000000001,
    "roomId": 0,
    "contentType": 2001,
    "sendTime": 1794305170,
    "appInfo": "<base64>",
    "senderName": "张**",
    "content": {
      "msgType": 2001,
      "hex": "080010c2f588062800"
    },
    "extraData": null,
    "flag": 0,
    "devInfo": 131075,
    "summary": ""
  },
  "detail": "",
  "message": "ok",
  "time": "2026-11-10 18:06:10"
}

响应字段 ​

响应字段(20 项)
字段类型说明
codeint64统一封套状态码:0=成功,负数=失败
dataobject该会话的最后一条消息
data.idint64消息 id
data.syncKeyint64同步序列号
data.messageTypeint640 单聊、1 群聊、3 系统通知
data.fromUserIdint64发送方
data.toUserIdint64接收方
data.roomIdint64群消息时为群 id,单聊为 0
data.contentTypeint64消息类型,示例里的 2001 是系统类消息
data.sendTimeint64发送时间,秒级时间戳
data.senderNamestring发送方昵称
data.contentobject消息内容
data.content.msgTypeint64同 contentType
data.content.hexstring消息体的十六进制原文
data.appInfostring透传串,不需要解析
data.devInfoint64设备标记,原样保存即可
data.summarystring摘要,可能为空串
detailstring附加明细,通常为空
messagestring文案:成功为 ok;失败形如 -码|描述
timestring服务端处理时间 YYYY-MM-DD HH:MM:SS

下一步 ​