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
Header Name | Example Value | Optional | Type | Description |
---|---|---|---|---|
operationID | 1646445464564 | Required | string | Used for global trace tracking; suggested to use a unique timestamp per request |
token | eyJhbxxxx3Xs | Required | string | Admin 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 Name | Optional | Type | Description |
---|---|---|---|
sendID | Required | string | System notification ID, or user ID |
recvID | Optional | string | Receiver ID, required if sessionType is 1 or 4; if it's a group chat, leave blank |
groupID | Optional | string | Group ID, required if sessionType is 3; leave blank for one-to-one chats |
senderNickname | Optional | string | Sender’s nickname |
senderFaceURL | Optional | string | Sender’s avatar URL |
senderPlatformID | Optional | int | Sender’s platform type, value from 1-9 |
content | Required | object | Message content; refer to Message Type Format Description |
content.content | Required | string | Message content text |
contentType | Required | int | Message type |
sessionType | Required | int | Conversation type |
isOnlineOnly | Optional | boolean | Receiver must be online to receive; otherwise, message is dropped |
notOfflinePush | Optional | boolean | Do not push offline notifications |
sendTime | Optional | int | Send time in milliseconds; only for imported messages |
offlinePushInfo | Optional | object | Details for offline push notification |
offlinePushInfo.title | Optional | string | Push notification title |
offlinePushInfo.desc | Optional | string | Push notification description |
offlinePushInfo.ex | Optional | string | Extended field |
offlinePushInfo.iOSPushSound | Optional | string | iOS push notification sound |
offlinePushInfo.iOSBadgeCount | Optional | boolean | iOS badge count on app icon |
ex | Optional | string | Extended field |
Success Response Example
{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"serverMsgID": "8698dd5d163dd79b8fdfa333fee06f40",
"clientMsgID": "1ca0e4cf279ad5cce6b28331b2b42092",
"sendTime": 1679558586210
}
}
Success Response Parameters Description
Parameter Name | Type | Description |
---|---|---|
errCode | int | Error code; 0 indicates success |
errMsg | string | Brief error message, empty if none |
errDlt | errDlt | Detailed error information, empty if none |
data | object | General data object, structure detailed below |
serverMsgID | string | Server message ID; reserved field |
clientMsgID | string | Client message ID; unique ID for message |
sendTime | int | Time the message was sent |
Failure Response Example
{
"errCode": 1004,
"errMsg": "RecordNotFoundError",
"errDlt": ": [1004]RecordNotFoundError"
}
Failure Response Parameters Description
Parameter Name | Type | Description |
---|---|---|
errCode | int | Error code, refer to global error code documentation |
errMsg | string | Brief error message |
errDlt | errDlt | Detailed error information |