# 更新消息
更新指定消息内容,支持卡片。
注意事项:
- 需要开启机器人能力
- 给群组发送消息,需要机器人在群中
- 文本消息长度最大不能超过5000
# 请求
| 基本 | |
|---|---|
| HTTP URL | https://hi-qa.weizhipin.com/open-apis/im/messages/{message_id}/update |
| HTTP Method | POST |
| 支持的应用类型 | 自建应用 商店应用 |
| 权限要求开启任一权限即可 | 获取用户给机器人发送的信息、向用户发送单聊、群聊消息 |
# 请求头
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | string | 是 | tenant_access_token 值格式:"Bearer access_token"示例值:"Bearer t-7f1bcd13fc57d46bac21793a18e560" |
| Content-Type | string | 是 | 固定值:"application/json; charset=utf-8" |
# 请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| content | string | 是 | 消息内容,json结构序列化后的字符串。不同msg_type对应不同内容。 消息内容详细说明 |
| msg_type | string | 是 | 消息类型 当前仅支持 compressive_card(消息卡片)、system_card(消息卡片,已废弃类型) |
# 请求体示例
# 消息卡片(compressive_card)
新的卡片消息,持续迭代中资源介绍
{
"content": "{ \"header\": { \"text\": { \"content\": \"多文本1\", \"tag\": \"plain_text\" }, \"color\": \"white\" }, \"cardLink\": { \"url\": \"https://www.baidu.com\", \"pcUrl\": \"https://www.4399.com\", \"androidUrl\": \"\", \"iosUrl\": \"\" }, \"globalConfig\": { \"forward\": false, \"shareCard\": true }, \"modules\": [ { \"tag\": \"split_line\" }, { \"fields\": [ { \"text\": { \"content\": \"多文本1\", \"tag\": \"plain_text\" }, \"needLayout\": true }, { \"text\": { \"content\": \"多文本2\", \"tag\": \"plain_text\" }, \"needLayout\": true }, { \"text\": { \"content\": \"多文本3\", \"tag\": \"plain_text\" }, \"needLayout\": true }, { \"text\": { \"content\": \"多文本4\", \"tag\": \"plain_text\" }, \"needLayout\": true } ], \"extra\": { \"text\": { \"content\": \"按钮中展示的文本\", \"tag\": \"plain_text\" }, \"multiUrl\": { \"url\": \"https://www.baidu.com\", \"pcUrl\": \"https://www.4399.com\", \"androidUrl\": \"\", \"iosUrl\": \"\" }, \"callBacks\": [ { \"key\": \"click1\", \"value\": \"1\" } ], \"confirm\": { \"title\": { \"content\": \"弹窗标题\", \"tag\": \"plain_text\" }, \"text\": { \"content\": \"弹窗内容\", \"tag\": \"plain_text\" } }, \"type\": \"primary\", \"tag\": \"button\" }, \"arrange\": \"bisected\", \"tag\": \"div\" }, { \"actions\": [ { \"text\": { \"content\": \"按钮中展示的文本1\", \"tag\": \"plain_text\" }, \"multiUrl\": { \"url\": \"https://www.baidu.com\", \"pcUrl\": \"https://www.4399.com\", \"androidUrl\": \"\", \"iosUrl\": \"\" }, \"callBacks\": [ { \"key\": \"click1\", \"value\": \"1\" } ], \"confirm\": { \"title\": { \"content\": \"弹窗标题\", \"tag\": \"plain_text\" }, \"text\": { \"content\": \"弹窗内容\", \"tag\": \"plain_text\" } }, \"needLayout\": true, \"type\": \"primary\", \"tag\": \"button\" }, { \"text\": { \"content\": \"按钮中展示的文本2\", \"tag\": \"plain_text\" }, \"multiUrl\": { \"url\": \"https://www.baidu.com\", \"pcUrl\": \"https://www.4399.com\", \"androidUrl\": \"\", \"iosUrl\": \"\" }, \"callBacks\": [ { \"key\": \"click1\", \"value\": \"1\" } ], \"confirm\": { \"title\": { \"content\": \"弹窗标题\", \"tag\": \"plain_text\" }, \"text\": { \"content\": \"弹窗内容\", \"tag\": \"plain_text\" } }, \"type\": \"primary\", \"tag\": \"button\" }, { \"text\": { \"content\": \"按钮中展示的文本3\", \"tag\": \"plain_text\" }, \"multiUrl\": { \"url\": \"https://www.baidu.com\", \"pcUrl\": \"https://www.4399.com\", \"androidUrl\": \"\", \"iosUrl\": \"\" }, \"callBacks\": [ { \"key\": \"click1\", \"value\": \"1\" } ], \"confirm\": { \"title\": { \"content\": \"弹窗标题\", \"tag\": \"plain_text\" }, \"text\": { \"content\": \"弹窗内容\", \"tag\": \"plain_text\" } }, \"type\": \"primary\", \"tag\": \"button\" } ], \"arrange\": \"bisected\", \"tag\": \"actions\" } ]}",
"msg_type": "compressive_card"
}
1
2
3
4
2
3
4
# 响应
# 响应体
| 名称 | 类型 | 描述 |
|---|---|---|
| code | int | 错误码,非 0 表示失败 |
| msg | string | 错误描述 |
| data | message | - |
| ∟message_id | string | 消息id |
# 响应体示例
{
"code": 0,
"traceId": "_Ao59UOIBLPCeAAu",
"success": true,
"data": {
"message_id": "dad41d0f45a6fee21kEWDPHnxa_cLKc~"
},
"msg": "操作成功"
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9