Callback Before Setting Group Information
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
Parameter | Description |
---|---|
https | Request protocol is HTTPS, method is POST |
https://callbackurl | Callback URL |
CallbackCommand | Fixed value: setGroupInfoBeforeCommand |
contenttype | Fixed value: JSON |
Header
Header Name | Example Value | Mandatory | Type | Description |
---|---|---|---|---|
operationID | 1646445464564 | Required | string | operationID for global link tracing |
Request Packet Example
{
"callbackCommand": "setGroupInfoBeforeCommand",
"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
Field | Type | Description |
---|---|---|
callbackCommand | string | Callback command, here for setting group info before the callback |
groupInfoForSet | object | Object containing the group information to be set |
groupID | string | Unique identifier of the group |
groupName | string | Name of the group |
notification | string | Group notification information |
introduction | string | Introduction of the group |
faceURL | string | URL of the group icon |
ex | StringValue | Additional data field |
needVerification | Int32Value | Whether verification is needed to join the group |
lookMemberInfo | Int32Value | Whether group member information can be viewed |
applyMemberFriend | Int32Value | Whether 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
Field | Type | Description |
---|---|---|
actionCode | 0 | Indicates if the business system's callback was executed correctly. 0 means the operation was successful. |
errCode | 5001 | Custom 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. |
nextCode | 1 | Next step instruction, 1 means to refuse to continue executing, set when actionCode is 0 . |
groupID | string | Unique identifier of the group |
groupName | string | Name of the group |
notification | string | Group notification information |
introduction | string | Introduction of the group |
faceURL | string | URL of the group icon |
ex | StringValue | Additional data field |
needVerification | Int32Value | Whether verification is needed to join the group |
lookMemberInfo | Int32Value | Whether group member information can be viewed |
applyMemberFriend | Int32Value | Whether group members can apply to be friends |