# 批量更新消息

给多个用户或者多个部门发送消息。

注意事项:

  • 应用需要启用机器人能力
  • 只能发送给用户,无法发送给群组(群聊)
  • 仅支持 msg_type = compressive_card的消息被批量更新
  • 接口权限说明:
    • 必须拥有[API]批量发送单聊消息权限
    • [API]批量发送单聊消息,权限可能存在于多个权限组,开通不同的权限组生效范围不同
    • [权限组]批量向用户发送消息,用于给用户发送批量消息
    • [权限组]批量向部门发送消息,用于给部门发送批量消息
  • 应用需要拥有对所发送用户或部门的可用性
  • 异步接口,会有一定延迟,每个应用待发送的消息按顺序处理,请合理安排批量发送范围和顺序。发送消息给单个用户的场景请使用发送消息接口

# 请求

基本
HTTP URL https://hi-gw.weizhipin.com/open-apis/im/v2/batch_update
HTTP Method POST
支持的应用类型 自建应用
商店应用
权限要求
根据发送目标申请相应权限
批量向用户发送消息
批量向部门发送消息

# 请求头

名称 类型 必填 描述
Authorization string tenant_access_token
值格式:"Bearer access_token"
示例值:"Bearer t-7f1bcd13fc57d46bac21793a18e560"
Content-Type string 固定值:"application/json; charset=utf-8"

# 请求体

参数 类型 必填 描述
message_id string 批量发送的消息返回的message_id
content string 消息内容,仅支持compressive_card类型的消息内容

# 消息卡片

新的卡片消息,持续迭代中资源介绍

{
  "content":"{    \"header\": {        \"text\": {            \"content\": \"多文本2\",            \"tag\": \"plain_text\"        },        \"color\": \"brand1\"    },    \"cardLink\": {        \"url\": \"https://hi.zhipin.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://hi.zhipin.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\": \"main\",                \"tag\": \"button\"            },            \"arrange\": \"bisected\",            \"tag\": \"div\"        },        {            \"actions\": [                {                    \"text\": {                        \"content\": \"按钮中展示的文本1\",                        \"tag\": \"plain_text\"                    },                    \"multiUrl\": {                        \"url\": \"https://hi.zhipin.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\": \"main\",                    \"tag\": \"button\"                },                {                    \"text\": {                        \"content\": \"按钮中展示的文本2\",                        \"tag\": \"plain_text\"                    },                    \"multiUrl\": {                        \"url\": \"https://hi.zhipin.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\": \"main\",                    \"tag\": \"button\"                },                {                    \"text\": {                        \"content\": \"按钮中展示的文本3\",                        \"tag\": \"plain_text\"                    },                    \"multiUrl\": {                        \"url\": \"https://hi.zhipin.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\": \"main\",                    \"tag\": \"button\"                }            ],            \"arrange\": \"bisected\",            \"tag\": \"actions\"        }    ]}",
  "message_id": "99d51ed70eced10d0kwbCfM~11"
}
1
2
3
4

# 响应体

参数 类型 说明
code int 错误码,非 0 表示失败
msg string 错误描述
success boolean 返回是否成功
data boolean 跟新是否成功

# 响应体示例

{
  "code": 0,
   "traceId": "_Ao59UOIBLPCeAAu",
  "success": true,
  "data": true,
  "msg": "操作成功"
}
1
2
3
4
5
6
7
最后更新于 : 11/3/2023, 9:53:27 AM