Platform API
Batch send messages
Use this endpoint to send the same message to multiple users or to deliver a low-frequency system notification to all users. Batch delivery amplifies message writes, push traffic, and conversation updates, so apply business approval and rate limits.
HTTP request
POST {API_ADDRESS}/msg/batch_send_msgRequest example
curl --request POST "${API_ADDRESS}/msg/batch_send_msg" \
--header "Content-Type: application/json; charset=utf-8" \
--header "operationID: ${OPERATION_ID}" \
--header "token: ${ADMIN_TOKEN}" \
--data-raw '{
"sendID": "openIMAdmin",
"recvIDs": ["user_001", "user_002"],
"isSendAll": false,
"groupID": "",
"content": {"content": "hello"},
"contentType": 101,
"sessionType": 1,
"isOnlineOnly": false,
"notOfflinePush": false,
"sendTime": 1719800000000,
"ex": ""
}'Request body
| Parameter | Required | Type | Description |
|---|---|---|---|
| recvIDs | Selected users | string[] | Recipient IDs when isSendAll is false. |
| isSendAll | No | boolean | When true, the server pages through all users and sends the message. |
| sendID | Yes | string | Sender user or notification account ID. |
| groupID | Group | string | Target group when sessionType is 3. |
| content | Yes | object | Payload defined by Message content types. |
| contentType | Yes | int | Message content type. |
| sessionType | Yes | int | Conversation type. See ConversationType. |
| isOnlineOnly | No | boolean | Deliver online only without persistence, history, sender sync, or conversation updates. |
| notOfflinePush | No | boolean | Disable offline push when true. |
| sendTime | No | int | Send time in Unix milliseconds. |
| offlinePushInfo | No | object | Offline push information, with the same fields as Send a message. |
| ex | No | string | Message extension data. |
Response
{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"results": [{
"serverMsgID": "server_msg_001",
"clientMsgID": "client_msg_001",
"sendTime": 1719800000000,
"recvID": "user_001"
}],
"failedUserIDs": ["user_002"]
}
}data.results lists successful deliveries and data.failedUserIDs lists recipients that failed. A top-level errCode of 0 does not mean every recipient succeeded; inspect both arrays.
Use isSendAll: true only for low-frequency system notifications. It is not suitable for high-frequency marketing delivery.
Related pages
Was this page helpful?