Skip to main content

Batch Send Message

Brief Description

  • Batch send messages.

Request Method

  • POST

Request URL

  • {API_ADDRESS}/msg/batch_send_msg
Header NameExample ValueRequiredTypeDescription
operationID1646445464564RequiredstringoperationID used for global tracing
tokeneyJhbxxxx3XsRequiredstringAdmin token

Request Parameter Example

{
"sendID": "openIMAdmin",
"senderNickname": "Gordon",
"senderFaceURL": "http://www.head.com",
"senderPlatformID": 1,
"content": {
"text": "{\"content\":\"hello world!\"}"
},
"contentType": 101,
"sessionType": 1,
"isOnlineOnly": false,
"notOfflinePush": false,
"offlinePushInfo": {
"title": "send message",
"desc": "",
"ex": "",
"iOSPushSound": "default",
"iOSBadgeCount": true
},
"isSendAll": true
}

Parameter Description

Field NameRequiredTypeDescription
sendIDRequiredstringSender ID (can be admin ID or user ID)
recvIDsOptionalarrayList of receiver IDs, required for sessionType 1 or 4, for individual user chats; leave empty for group chats
senderNicknameOptionalstringSender's nickname
senderFaceURLOptionalstringSender's profile picture URL
senderPlatformIDOptionalintSender's platform ID, fill when simulating user sending: 1->iOS, 2->Android, 3->Windows, 4->OSX, 5->Web, 6->MiniWeb, 7->Linux, 8->AndroidPad, 9->iPad
contentRequiredobjectThe actual message content, internally a JSON object, for details refer to the message type format documentation
contentTypeRequiredintMessage type, 101 for text, 102 for image, etc. Refer to message type format documentation for more details
sessionTypeRequiredintConversation type, 1 for individual chat, 2 for group chat (normal write spread), 3 for large group (read spread interface), 4 for notification conversation
isOnlineOnlyOptionalbooleanWhen set to true, the message is not stored on the server; only online recipients will receive the message, and the message will be lost if they are offline
notOfflinePushOptionalbooleanWhen set to true, the message will not trigger offline push notifications for offline users
offlinePushInfoOptionalobjectOffline push notification details, if not provided, default server push title is used
offlinePushInfo.titleOptionalstringPush notification title
offlinePushInfo.descOptionalstringPush notification description
offlinePushInfo.exOptionalstringExtension field
offlinePushInfo.iOSPushSoundOptionalstringiOS push sound
offlinePushInfo.iOSBadgeCountOptionalbooleanWhether the iOS push notification increments the badge count on the app icon
isSendAllOptionalbooleanWhether to send to all users

Success Response Example


Success Response Parameter Description

Parameter NameTypeDescription
errCodeintError code, 0 indicates success
errMsgstringBrief error message, empty if no error
errDltstringDetailed error message, empty if no error
dataobjectGeneral data object, refer to the structure below

Failure Response Example

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

Failure Response Parameter Description

Parameter NameTypeDescription
errCodeintError code, refer to the global error code documentation for details
errMsgstringBrief error message
errDltstringDetailed error message