Appearance
查询置顶 / 免打扰会话
查询当前账号置顶、免打扰的会话(部分账号还有收藏)。
说明与注意
- 没有数据的列表不会出现在返回里,解析时每个键都要判空。
remoteId用 BigInt 或 json-bigint 解析,不要转成 Number。
请求参数
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
appid | 是 | string | 实例 appid,标识操作哪个已登录账号。示例:we_xxxxxxxxxxxxxxx |
请求示例
http
POST {BASE_URL}/api/room/sessionQueryList
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"appid": "we_xxxxxxxxxxxxxxx"
}bash
curl -X POST '{BASE_URL}/api/room/sessionQueryList' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"appid": "we_xxxxxxxxxxxxxxx"
}'python
import requests
url = "{BASE_URL}/api/room/sessionQueryList"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"appid": "we_xxxxxxxxxxxxxxx"
}"""
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/room/sessionQueryList";
String body = "{\n" +
" \"appid\": \"we_xxxxxxxxxxxxxxx\"\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/room/sessionQueryList';
$body = <<<'JSON'
{
"appid": "we_xxxxxxxxxxxxxxx"
}
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": {
"shieldSessions": [
{
"conversationType": 1,
"remoteId": 10786447466811918,
"remainTime": -1,
"forwardId": 0,
"foldState": 1
},
{
"conversationType": 3,
"remoteId": 10031,
"remainTime": -1,
"forwardId": 0,
"foldState": 0
}
],
"topSessions": [
{
"conversationType": 1,
"remoteId": 10786447466811918,
"forwardId": 0
}
]
},
"detail": "",
"message": "ok",
"time": "2026-11-10 14:57:17"
}响应字段
响应字段(16 项)
| 字段 | 类型 | 说明 |
|---|---|---|
code | int64 | 统一封套状态码:0=成功,负数=失败 |
data | object | 会话组 |
data.shieldSessions | array<object> | 免打扰的会话;没有时不返回 |
data.shieldSessions[].conversationType | int64 | 0 好友单聊、1 群;其他值是企微内部会话,跳过 |
data.shieldSessions[].remoteId | int64 | 会话对端 id:群是 roomId,单聊是对方 userId |
data.shieldSessions[].forwardId | int64 | 转发来源 id,通常为 0 |
data.shieldSessions[].remainTime | int64 | 示例里为 -1,原样保存即可 |
data.shieldSessions[].foldState | int64 | 折叠状态,0 或 1 |
data.topSessions | array<object> | 置顶的会话;没有时不返回 |
data.topSessions[].conversationType | int64 | 0 好友单聊、1 群;其他值是企微内部会话,跳过 |
data.topSessions[].remoteId | int64 | 会话对端 id:群是 roomId,单聊是对方 userId |
data.topSessions[].forwardId | int64 | 转发来源 id,通常为 0 |
data.collectSessions | array<object> | 收藏的会话;部分账号才返回 |
detail | string | 附加明细,通常为空 |
message | string | 文案:成功为 ok;失败形如 -码|描述 |
time | string | 服务端处理时间 YYYY-MM-DD HH:MM:SS |