Callback After Sending Group Messages
Function Description
The App business server can use this callback to real-time view users' group messages, including:
- Notifying the App backend about the successful sending of group messages.
- Enabling the App to perform necessary data synchronization.
Precautions
- To enable the callback, you must configure the callback URL and activate the switch corresponding to this callback protocol. See the Callback Description document for configuration methods.
- The direction of the callback is an HTTP/HTTPS POST request initiated by OpenIM Server to the App backend.
- The App business server needs to verify whether the command parameter in the request URL is its own SDKNAME parameter after receiving the callback request.
- The APP business server is required to respond to this request within the timeout period.
Scenarios That May Trigger This Callback
- App users send group messages through the client.
- App administrators send group messages through the REST API.
Timing of the Callback
- After the group message is successfully sent.
Interface Description
Request URL Example
In the following example, the configured callback URL of the App is https://callbackurl
.
https://callbackurl?command=$CallbackCommand&contenttype=json
Request Parameter Description
Parameter | Description |
---|---|
https | Request protocol is HTTPS, request method is POST. |
https://callbackurl | Callback URL |
CallbackCommand | Fixed value: callbackAfterSendGroupMsgCommand |
contenttype | Fixed value: JSON |
Header
Header Name | Example Value | Optional | Type | Description |
---|---|---|---|---|
operationID | 1646445464564 | Required | string | operationID used for global tracing |
Request Packet Example
{
"sendID": "sender123",
"callbackCommand": "callbackAfterSendGroupMsgCommand",
"serverMsgID": "serverMsg123",
"clientMsgID": "clientMsg123",
"senderPlatformID": 1,
"senderNickname": "JohnDoe",
"sessionType": 2,
"msgFrom": 1,
"contentType": 1,
"status": 1,
"createTime": 1673048592000,
"content": "Hello, this is a group message!",
"seq": 1,
"atUserList": ["user456", "user789"],
"faceURL": "http://example.com/path/to/sender/face/image.png",
"ex": "Extra data",
"groupID": "group123"
}
Request Packet Field Description
Field | Type | Description |
---|---|---|
sendID | string | Unique identifier of the sender |
callbackCommand | string | Callback command, here for after sending group messages |
serverMsgID | string | Message ID generated by the server |
clientMsgID | string | Message ID generated by the client |
senderPlatformID | int32 | Platform ID of the sender |
senderNickname | string | Nickname of the sender |
sessionType | int32 | Type of session |
msgFrom | int32 | Origin of the message |
contentType | int32 | Type of message content |
status | int32 | Status of the message |
createTime | int64 | Timestamp of message creation (milliseconds) |
content | string | Content of the message |
seq | uint32 | Sequence number of the message |
atUserList | array | List of user IDs mentioned in the group |
senderFaceURL | string | URL of the sender's face image |
ex | string | Additional data field |
groupID | string | Unique identifier of the group |
Response Packet Example
Successful Response
After the App business server synchronizes the data, it sends a callback response packet.
{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": ""
}
Response Packet Field Description
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates whether the business system's callback was executed correctly. 0 means the operation was successful. |
errCode | 0 | Represents a custom error code, here 0 indicates ignoring the callback result. |
errMsg | "An error message" | Simple error message corresponding to the custom error code. |