Skip to main content

Send Message

Brief Description

  • Simulate sending a message to a specified user or group. Can also be used to import historical records from other platforms.

Request Method

  • post

Request URL

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

Request Parameters Example

{
"sendID": "openIMAdmin",
"recvID": "2839678182",
"groupID": "",
"senderNickname": "openIMAdmin-Gordon",
"senderFaceURL": "http://www.head.com",
"senderPlatformID": 1,
"content": {
"content": "hello!!"
},
"contentType": 101,
"sessionType": 1,
"isOnlineOnly": false,
"notOfflinePush": false,
"sendTime": 1695212630740,
"offlinePushInfo": {
"title": "send message",
"desc": "",
"ex": "",
"iOSPushSound": "default",
"iOSBadgeCount": true
},
"ex": "ex"
}
Field NameOptionalTypeDescription
sendIDRequiredstringSystem notification ID, or user ID
recvIDOptionalstringReceiver ID, required if sessionType is 1 or 4; if it's a group chat, leave blank
groupIDOptionalstringGroup ID, required if sessionType is 3; leave blank for one-to-one chats
senderNicknameOptionalstringSender’s nickname
senderFaceURLOptionalstringSender’s avatar URL
senderPlatformIDOptionalintSender’s platform type, value from 1-9
contentRequiredobjectMessage content; refer to Message Type Format Description
content.contentRequiredstringMessage content text
contentTypeRequiredintMessage type
sessionTypeRequiredintConversation type
isOnlineOnlyOptionalbooleanReceiver must be online to receive; otherwise, message is dropped
notOfflinePushOptionalbooleanDo not push offline notifications
sendTimeOptionalintSend time in milliseconds; only for imported messages
offlinePushInfoOptionalobjectDetails for offline push notification
offlinePushInfo.titleOptionalstringPush notification title
offlinePushInfo.descOptionalstringPush notification description
offlinePushInfo.exOptionalstringExtended field
offlinePushInfo.iOSPushSoundOptionalstringiOS push notification sound
offlinePushInfo.iOSBadgeCountOptionalbooleaniOS badge count on app icon
exOptionalstringExtended field

Success Response Example

{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"serverMsgID": "8698dd5d163dd79b8fdfa333fee06f40",
"clientMsgID": "1ca0e4cf279ad5cce6b28331b2b42092",
"sendTime": 1679558586210
}
}

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
serverMsgIDstringServer message ID; reserved field
clientMsgIDstringClient message ID; unique ID for message
sendTimeintTime the message was sent

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