在线调试
批量发送自定义系统通知
更新时间: 2025/08/21 17:27:49
该接口可以批量发送多条 单聊 自定义系统通知。
调用频率
单个应用默认最高调用频率请参考 频控说明。
请求信息
请求 URL
POST https://{endpoint}/im/v2/custom_notification/batch
请求 URL 中的 {endpoint}
代表服务地址域名,您可以根据用户服务区域选择中国大陆和海外服务地址,并支持搭建高可用主备域名机制。详情请参考 调用方式 服务地址章节。
请求头参数
请求 Header 的参数说明请参考 请求 Header。
请求体参数
参数名称 | 类型 | 是否必选 | 描述 |
---|---|---|---|
sender_id |
String | 是 | 发送者 IM 账号 ID。 |
receiver_ids |
Array of strings | 是 | 接收者账号 ID 列表,JSON 格式。最多传入 500 个 IM 账号。 |
content |
String | 是 | 自定义系统通知的内容,由开发者自行组装的 JSON 格式字符串,长度上限 4096 位字符。 |
sound |
String | 否 | 指定的客户端本地的声音文件名,长度上限 30 位字符。 |
-
notification_config |
Object | 否 | 通知配置项,不填则采用默认值。 |
offline_enabled |
Boolean | 否 | 是否需要存离线消息,默认为 true(存离线)。 |
unread_enabled |
Boolean | 否 | 是否计入未读数,默认为 true(计入)。 |
-
push_config |
Object | 否 | 推送相关配置项。 |
push_enabled |
Boolean | 否 | 该消息是否需要 APNs 推送或 Android 系统通知栏推送,默认为 true(推送)。只有该字段为 true 时,推送相关参数才会生效。 |
push_nick_enabled |
Boolean | 否 | 推送文案是否需要带上昵称,默认为 true(带昵称)。 |
push_content |
String | 否 | 推送文案,长度上限 500 位字符。push_ content 字段,则不会触发推送服务,但会将 push_payload 字段内容下发给客户端。 |
push_payload |
String | 否 | 推送对应的 payload,必须是 JSON 格式,长度上限 2048 位字符。详情请参考 推送 payload 配置。 |
push_forcepush_enable |
Boolean | 否 | 该消息(群消息)是否强制推送(@操作),默认为 false。只有该字段为 true 时强制推送相关参数才会生效。 |
push_forcepush_all |
Boolean | 否 | 该消息(群消息)是否强制推送(@操作)给群组中所有有效成员(除消息发送者),默认为 false。 |
push_forcepush_ids |
Array of strings | 否 | 该消息(群消息)的强推(@操作)账号列表,格式为 JSONArray,如["account1","account2"]。若 push_forcepush_all 为 true,则该字段无效,该消息会强制推送(@操作)给群组中所有有效成员(除消息发送者)。 |
push_forcepush_content |
String | 否 | 强制推送的文案,仅针对强推列表 push_forcepush_ids 中的账号,长度上限 500 位字符。 |
-
route_config |
Object | 否 | 抄送相关配置项。 |
route_enabled |
Boolean | 否 | 该消息是否需要抄送至指定的应用服务器(需要为应用开通消息抄送功能),默认为 true(抄送)。 |
route_environment |
String | 否 | 当前消息需要抄送到的环境的名称,对应您在网易云信控制台中配置的自定义抄送的环境名称。 |
请求体示例
JSON{
"sender_id": "sender123456",
"content": "string",
"push_config": {
"push_enabled": true,
"push_nick_enabled": false,
"push_content": "string",
"push_payload": null,
"push_forcepush_all": false,
"push_forcepush_ids": [
"30"
],
"push_forcepush_content": "string"
},
"sound": "string",
"route_config": {
"route_enabled": false,
"route_environment": null
},
"notification_config": {
"offline_enabled": false,
"unread_enabled": false
},
"receiver_ids": [
"apifoxtest10",
"apifoxtest32"
]
}
响应信息
响应头参数
响应 Header 的参数说明请参考 响应 Header。
响应体参数
参数名称 | 类型 | 说明 | 是否必返回 |
---|---|---|---|
code |
Integer | 状态码,200 表示请求成功。 | 是 |
msg |
String | 提示信息。请求失败时返回错误信息,请求成功时返回 "success"。 | 是 |
-
data |
Object | 返回的 JSON 数据对象,请求失败则返回空对象。 | 是 |
-
success_list |
Array of strings | 发送成功的的自定义系统通知。 | 否 |
account_id |
String | 自定义系统通知接收者账号 ID。 | 否 |
-
failed_list |
Array of objects | 发送失败的自定义系统通知。 | 否 |
account_id |
String | 自定义系统通知接收者中的不存在(未注册)的账号 ID。 | 否 |
error_msg |
String | 操作错误信息。 | 否 |
error_code |
Integer | 操作错误码。 | 否 |
响应体示例
JSON{
"code": 200,
"msg": "success",
"data": {
"failed_list": [
{
"account_id": "hkj-100",
"error_msg": "error",
"error_code": 102404
}
],
"success_list": ["hkj1"]
}
}
错误码
本文仅列举部分业务接口错误码,完整列表请参考客户端 API 错误码。
错误码 | 错误码描述 | 错误信息示例 |
---|---|---|
200 | 请求成功 | success |
414 | 参数错误 | parameter error |
416 | 频率超限 | rate limit exceeded |
102404 | 用户不存在 | account not exist |
500 | 服务器内部错误 | internal server error |
503 | 服务繁忙 | server busy |
此文档是否对你有帮助?