Skip to main content

Callback Before Setting Group Information EX

Function Description

The App business server can intervene before setting group information through this callback. This enables the business server to review or modify the request before actually changing the group information.

Precautions

  • To enable the callback, you must configure the callback URL and activate the switch corresponding to this callback protocol. See the Callback Explanation document for configuration methods.
  • The direction of the callback is an HTTP/HTTPS POST request initiated by OpenIM Server to the App backend.
  • After receiving the callback request, the App business server needs to verify whether the command parameter in the request URL is its SDKNAME parameter.
  • The APP business server is required to respond to this request within the timeout period.

Scenarios That May Trigger This Callback

  • App users request to modify group information through the client.
  • App administrators modify group information through the REST API.

Timing of the Callback

  • After OpenIM Server receives the request to set group information, before processing the request.

Interface Description

Request URL Example

In the following example, the callback URL configured by the App is https://callbackurl.

https://callbackurl?command=$CallbackCommand&contenttype=json

Request Parameter Description

ParameterDescription
httpsRequest protocol is HTTPS, method is POST
https://callbackurlCallback URL
CallbackCommandFixed value: callbackBeforeSetGroupInfoEXCommand
contenttypeFixed value: JSON
Header NameExample ValueMandatoryTypeDescription
operationID1646445464564RequiredstringoperationID for global link tracing

Request Packet Example

{
"callbackCommand": "callbackBeforeSetGroupInfoEXCommand",
"groupInfoForSet": {
"groupID": "G002",
"groupName": "NewGroupName",
"notification": "Updated group notification",
"introduction": "Updated group introduction",
"faceURL": "http://example.com/new/path/to/face/image.png",
"ex": {
"value": "Updated extra data"
},
"needVerification": {
"value": 0
},
"lookMemberInfo": {
"value": 1
},
"applyMemberFriend": {
"value": 0
}
}
}

Request Packet Field Explanation

FieldTypeDescription
callbackCommandstringCallback command, here for setting group info before the callback
groupInfoForSetobjectObject containing the group information to be set
groupIDstringUnique identifier of the group
groupNamestringName of the group
notificationStringValueGroup notification information
introductionStringValueIntroduction of the group
faceURLStringValueURL of the group icon
exStringValueAdditional data field
needVerificationInt32ValueWhether verification is needed to join the group
lookMemberInfoInt32ValueWhether group member information can be viewed
applyMemberFriendInt32ValueWhether group members can apply to be friends

Response Packet Example

Allow Modification

Allows modification of group information.

{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": "nextCodeValue",
"groupInfoForSet": {
"groupID": "G002",
"groupName": "NewGroupName",
"notification": "Updated group notification",
"introduction": "Updated group introduction",
"faceURL": "http://example.com/new/path/to/face/image.png",
"ex": {
"value": "Updated extra data"
},
"needVerification": {
"value": 0
},
"lookMemberInfo": {
"value": 1
},
"applyMemberFriend": {
"value": 0
}
}
}

Response Packet Field Explanation

FieldTypeDescription
actionCode0Indicates if the business system's callback was executed correctly. 0 means the operation was successful.
errCode5001Custom error code, ranging between 5000-9999. Set when actionCode is not 0; set when nextCode is 1.
errMsg"An error message"Simple error message corresponding to the custom error code.
errDlt"Detailed error information"Detailed error information corresponding to the custom error code.
nextCode1Next step instruction, 1 means to refuse to continue executing, set when actionCode is 0.
groupIDstringUnique identifier of the group
groupNamestringName of the group
notificationStringValueGroup notification information
introductionStringValueIntroduction of the group
faceURLStringValueURL of the group icon
exStringValueAdditional data field
needVerificationInt32ValueWhether verification is needed to join the group
lookMemberInfoInt32ValueWhether group member information can be viewed
applyMemberFriendInt32ValueWhether group members can apply to be friends