Browse Platform API
Platform API

Batch send messages

Copy

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_msg

Request 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

ParameterRequiredTypeDescription
recvIDsSelected usersstring[]Recipient IDs when isSendAll is false.
isSendAllNobooleanWhen true, the server pages through all users and sends the message.
sendIDYesstringSender user or notification account ID.
groupIDGroupstringTarget group when sessionType is 3.
contentYesobjectPayload defined by Message content types.
contentTypeYesintMessage content type.
sessionTypeYesintConversation type. See ConversationType.
isOnlineOnlyNobooleanDeliver online only without persistence, history, sender sync, or conversation updates.
notOfflinePushNobooleanDisable offline push when true.
sendTimeNointSend time in Unix milliseconds.
offlinePushInfoNoobjectOffline push information, with the same fields as Send a message.
exNostringMessage 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.