Skip to main content

Callback Before Setting Group Information

Description

The App backend can use this callback to intervene before setting group information. This enables the backend to review or modify the request before actually modifying group information.

Important Notes

  • To enable this callback, configure the callback URL and activate the corresponding protocol switch. For configuration details, see the Callback Introduction document.
  • The callback direction is from OpenIMServer to the App backend as an HTTP/HTTPS POST request.
  • The App business server must respond within the specified timeout period.

Scenarios that Trigger This Callback

  • A user requests to modify group information through the App client.
  • An App administrator changes group information via the REST API.

Timing of Callback

  • After OpenIMServer receives the request to set group information, but before processing it.

Interface Description

Example Request URL

The CallbackCommand here is: callbackBeforeSetGroupInfoExCommand

{WEBHOOK_ADDRESS}/callbackBeforeSetGroupInfoExCommand?contenttype=json

Example Request Package

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

Request Package Field Descriptions

FieldTypeDescription
callbackCommandstringCallback command; here for pre-setting group information
operationIDstringFor global traceability; suggested to use a timestamp, unique per request
groupIDstringUnique identifier of the group
groupNameStringValueGroup name
notificationStringValueGroup notification information
introductionStringValueGroup introduction
faceURLStringValueURL of the group’s icon
exStringValueAdditional data field
needVerificationInt32ValueWhether verification is required to join the group
lookMemberInfoInt32ValueWhether group members’ info is visible
applyMemberFriendInt32ValueWhether members can request to add friends

Example Response Package

Allow Modification

Permits modification of the group information.

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

Response Package Field Descriptions

FieldTypeDescription
actionCode0Indicates whether the callback was successful. 0 means success.
errCode5001Custom error code; range 5000-9999. Set when actionCode ≠ 0; set when nextCode = 1.
errMsg"An error message"Simple error message for the custom error code.
errDlt"Detailed error information"Detailed error information for the custom error code.
nextCode1Next step directive; set to 1 to stop further action if actionCode = 0.
groupIDstringUnique identifier of the group
groupNameStringValueGroup name
notificationStringValueGroup notification information
introductionStringValueGroup introduction
faceURLStringValueURL of the group’s icon
exStringValueAdditional data field
needVerificationInt32ValueWhether verification is required to join the group
lookMemberInfoInt32ValueWhether group members’ info is visible
applyMemberFriendInt32ValueWhether members can request to add friends