Skip to main content

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

ParameterDescription
httpsRequest protocol is HTTPS, request method is POST.
https://callbackurlCallback URL
CallbackCommandFixed value: callbackAfterSendGroupMsgCommand
contenttypeFixed value: JSON
Header NameExample ValueOptionalTypeDescription
operationID1646445464564RequiredstringoperationID 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

FieldTypeDescription
sendIDstringUnique identifier of the sender
callbackCommandstringCallback command, here for after sending group messages
serverMsgIDstringMessage ID generated by the server
clientMsgIDstringMessage ID generated by the client
senderPlatformIDint32Platform ID of the sender
senderNicknamestringNickname of the sender
sessionTypeint32Type of session
msgFromint32Origin of the message
contentTypeint32Type of message content
statusint32Status of the message
createTimeint64Timestamp of message creation (milliseconds)
contentstringContent of the message
sequint32Sequence number of the message
atUserListarrayList of user IDs mentioned in the group
senderFaceURLstringURL of the sender's face image
exstringAdditional data field
groupIDstringUnique 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

FieldValueDescription
actionCode0Indicates whether the business system's callback was executed correctly. 0 means the operation was successful.
errCode0Represents a custom error code, here 0 indicates ignoring the callback result.
errMsg"An error message"Simple error message corresponding to the custom error code.