获取指定消息内容
获取指定message_id的内容:
- 获取单聊消息时,仅能是该应用的单聊
- 获取群聊消息时,机器人必须在被查询的群组中
请求说明
请求地址 | https://openapi.wps.cn/v7/chats/{chat_id}/messages/{message_id} |
---|---|
请求方法 | GET |
签名方式 | KSO-1 |
权限要求 | 查询和管理会话消息(应用授权) kso.chat_message.readwrite |
请求头(Header)
Header 名称 | 参数类型 | 是否必填 | 说明 |
---|---|---|---|
Content-Type | string | 是 | 使用:application/json |
X-Kso-Date | string | 是 | RFC1123 格式的日期,例: Wed, 23 Jan 2013 06:43:08 GMT |
X-Kso-Authorization | string | 是 | KSO-1 签名值,详见《签名方法》 |
Authorization | string | 是 | 授权凭证,格式为:Bearer {access_token} |
路径参数(Path)
名称 | 参数类型 | 是否必填 | 说明 |
---|---|---|---|
chat_id | string | 是 | 会话 id |
message_id | string | 是 | 消息 id |
请求地址示例
[GET] https://openapi.wps.cn/v7/chats/{chat_id}/messages/{message_id}
1
响应体
名称 | 参数类型 | 说明 |
---|---|---|
code | integer | 响应代码。非 0 表示失败,参照《状态码说明》 |
msg | string | 响应信息 |
data | object | 数据信息 |
∟ id | string | 消息id |
∟ type | string | 消息类型:"text-文本" "rich_text-富文本" "image-图片" "file-文件" "audio-音频" "video-视频" "card-卡片" |
∟ ctime | int | 消息生成的时间戳 |
∟ quote_msg_id | string | 被引用的消息ID |
∟ position | int | 会话消息位置索引,严格连续递增 |
∟ content | object | 消息内容 |
∟ ∟ text | object | 文本消息,见【发送消息接口】中详细描述 |
∟ ∟ rich_text | object | 富文本消息,见【发送消息接口】中详细描述 |
∟ ∟ image | object | 图片消息,见【发送消息接口】中详细描述 |
∟ ∟ file | object | 文件消息,见【发送消息接口】中详细描述 |
∟ ∟ audio | object | 音频消息,见【发送消息接口】中详细描述 |
∟ ∟ video | object | 视频消息,见【发送消息接口】中详细描述 |
∟ ∟ card | object | 卡片消息,见【发送消息接口】中详细描述 |
∟ sender | object | 发送者 |
∟ ∟ type | string | 发送者类型:user-用户,sp-应用服务主体 |
∟ ∟ id | string | 发送者的 ID,当发送者类型为user时返回user_id,当发送者类型为sp时返回spid(与应用appid不相同) |
∟ ∟ app_id | string | 应用id,只在type为sp时有值 |
∟ ∟ company_id | string | 发送者所属企业 |
∟ mentions | array | 消息@人列表 |
∟ ∟ type | string | at 操作对象类型 all :所有人;user :用户 |
∟ ∟ id | string | 指定聊天消息中at操作的实体索引ID。与消息正文中相应 标记中的 {index} 值匹配 |
∟ ∟ identity | object | 被 at 的用户信息,当 at 所有人时该值为空 |
∟ ∟ ∟ company_id | string | 被 at 的用户所属企业id |
∟ ∟ ∟ id | string | 被 at 的用户id |
∟ ∟ ∟ type | string | 被 at 的用户类型:user-用户,sp-应用服务主体 |
响应体示例
json
{
"code": 0,
"data": {
"chat_id": "8417257",
"content": {
"text": {
"content": "hel",
"type": "plain"
}
},
"ctime": 1744703111850,
"id": "Q3iOi5TYS6tBSgS1",
"mentions": [
{
"id": "string",
"identity": {
"company_id": "string",
"id": "string",
"type":"string"
},
"type": "string"
}
],
"position": 22,
"sender": {
"app_id": "",
"company_id": "648112656",
"id": "100002594211",
"type": "user"
},
"type": "text"
},
"msg": "success"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35