Skip to main content

Batch Send Messages

Brief Description

  • Sends messages in batch to multiple recipients.

Request Method

  • post

Request URL

  • {API_ADDRESS}/msg/batch_send_msg
Header NameExample ValueOptionalTypeDescription
operationID1646445464564RequiredstringUsed for global trace tracking, suggested to use a unique timestamp per request
tokeneyJhbxxxx3XsRequiredstringAdmin token

Request Parameters Example

{
"recvIDs": [
"9948077346",
"9371245179"
],
"sendID": "3473643418",
"senderNickname": "Alice",
"senderFaceURL": "http://nvpydodr.ae/ylyqu",
"senderPlatformID": 2,
"content": {
"content": "hello!!"
},
"contentType": 101,
"sessionType": 1,
"isOnlineOnly": false,
"notOfflinePush": false,
"sendTime": 1340619319058,
"offlinePushInfo": {
"title": "1213",
"desc": "in eiusmod magna",
"ex": "ex",
"iOSPushSound": "in Duis ut sunt nostrud",
"iOSBadgeCount": true
},
"ex": "ex",
"isSendAll": true
}
Field NameOptionalTypeDescription
recvIDsOptionalarrayList of recipient IDs. For session types 1 or 4, required for user ID; leave blank for group chat.
sendIDRequiredstringSender ID (can be admin or user ID).
senderNicknameOptionalstringSender's nickname.
senderFaceURLOptionalstringSender's avatar URL.
senderPlatformIDOptionalintSender's platform type.
contentRequiredobjectMessage content, a JSON object. See message format documentation.
contentTypeRequiredintMessage type.
sessionTypeRequiredintSession type.
isOnlineOnlyOptionalbooleanIf true, message is only sent when the receiver is online and won't be stored.
notOfflinePushOptionalbooleanIf true, message will not trigger offline push notifications when the user is offline.
sendTimeOptionalintTimestamp of message sending in milliseconds.
offlinePushInfoOptionalobjectOffline push content details; uses default server title if not provided. Not used if notOfflinePush is true.
offlinePushInfo.titleOptionalstringPush notification title.
offlinePushInfo.descOptionalstringPush notification description.
offlinePushInfo.exOptionalstringExtension field for push notification.
offlinePushInfo.iOSPushSoundOptionalstringiOS push notification sound.
offlinePushInfo.iOSBadgeCountOptionalbooleanWhether iOS push notification counts in app badge.
exOptionalstringExtension field.
isSendAllOptionalbooleanWhether to send to all users.

Success Response Example

{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"results": [
{
"serverMsgID": "b30cb040685c1ff3e92b32d25826a06e",
"clientMsgID": "ec5792358392cf9168eff64adfa4ac6a",
"sendTime": 1340619319058,
"recvID": "imAdmin"
},
{
"serverMsgID": "5f0987ef1bbdcd565c85befb1a084035",
"clientMsgID": "ec5792358392cf9168eff64adfa4ac6a",
"sendTime": 1340619319058,
"recvID": "3473643418"
},
{
"serverMsgID": "9ba70b63487559db1857ce324ae3bcf0",
"clientMsgID": "ec5792358392cf9168eff64adfa4ac6a",
"sendTime": 1340619319058,
"recvID": "9948077346"
},
{
"serverMsgID": "56f483592c3ee9fff1465d9b23277408",
"clientMsgID": "ec5792358392cf9168eff64adfa4ac6a",
"sendTime": 1340619319058,
"recvID": "9371245179"
},
{
"serverMsgID": "ee8b6bbd3190753bc0713c1085ccb479",
"clientMsgID": "ec5792358392cf9168eff64adfa4ac6a",
"sendTime": 1340619319058,
"recvID": "6412123282"
}
],
"failedUserIDs": null
}
}

Success Response Parameters Description

Parameter NameTypeDescription
errCodeintError code; 0 indicates success.
errMsgstringBrief error message, empty if none.
errDlterrDltDetailed error information, empty if none.
dataobjectGeneral data object, structure detailed below.
data.resultsarrayList of result objects.
serverMsgIDstringServer message ID, a reserved field.
clientMsgIDstringClient message ID, unique per message.
sendTimeintTimestamp of message sending.
recvIDstringRecipient ID.
data.failedUserIDsarrayList of user IDs where message sending failed.

Failure Response Example

{
"errCode": 1004,
"errMsg": "RecordNotFoundError",
"errDlt": ": [1004]RecordNotFoundError"
}

Failure Response Parameters Description

Parameter NameTypeDescription
errCodeintError code, refer to global error code documentation
errMsgstringBrief error message
errDlterrDltDetailed error information