Skip to main content

Send Message

Brief Description

  • Send a message to a designated user or group as someone, can also be used to import historical messages from other platforms.

Request Method

  • post

Request URL

  • {API_ADDRESS}/msg/send_msg
Header NameExample ValueOptionalTypeDescription
operationID1646445464564RequiredstringUsed for global link tracking, timestamp is recommended, independent in each request
tokeneyJhbxxxx3XsRequiredstringAdmin token

Request Parameter Example

{
"sendID": "openIMAdmin",
"recvID": "2839678182",
"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 number ID, or user ID
recvIDRequiredstringReceiver ID, fill in userID for single chat, groupID for group chat
senderPlatformIDOptionalintTerminal type of the message sender, defaults to 10
contentRequiredobjectSpecific content of the message, internally a json object, contentType sets different json objects, refer to Message types
contentTypeRequiredintMessage type
sessionTypeRequiredintSession type
isOnlineOnlyOptionalbooleanReceiver message options, defaults to false, the user will receive it whether offline or online; otherwise, only received when online
notOfflinePushOptionalbooleanOffline push settings, defaults to false, push offline; otherwise, do not push offline
sendTimeOptionalintMessage sending time, in milliseconds, generally filled in when importing historical messages
offlinePushInfoOptionalobjectSpecific content of the offline push, if not filled in, use the server's default push information. Becomes effective when notOfflinePush is false
offlinePushInfo.titleOptionalstringTitle for offline push
offlinePushInfo.descOptionalstringSpecific description for offline push
offlinePushInfo.exOptionalstringOffline push extension field
offlinePushInfo.iOSPushSoundOptionalstringOffline push sound for IOS
offlinePushInfo.iOSBadgeCountOptionalbooleanWhether IOS offline push messages count into desktop icon unread count
exOptionalstringExtension field

Success Return Example

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

Parameter Description for Success Return Example

Parameter NameTypeDescription
errCodeintError code, 0 means successful
errMsgstringBrief error message, empty
errDlterrDltDetailed error message, empty
dataobjectGeneric data object, specific structure is below
serverMsgIDstringServer message ID, reserved field
clientMsgIDstringClient message ID, this ID is the unique ID for the message
sendTimeintThe time the message was sent

Failure Return Example

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

Parameter Description for Failure Return Example

Parameter NameTypeDescription
errCodeintError code, specifically check the global error code document
errMsgstringBrief error message
errDlterrDltDetailed error message