Callback Before a User Joins a Group
Function Description
The App business server can view requests from users applying to join groups in real-time through this callback. This includes the ability of the App backend to intercept user requests to join groups.
Precautions
- To enable the callback, a callback URL must be configured, and the switch corresponding to this callback protocol must be turned on. For configuration methods, refer to the Callback Description document.
- The callback direction is an HTTP/HTTPS POST request initiated by OpenIM Server to the App backend.
- The App business server, upon receiving the callback request, needs to verify if the command parameter in the request URL is their SDK parameter.
- The APP business server needs to respond to this request within the timeout period.
Scenarios That May Trigger This Callback
- App users initiate a request to join a group through the client.
Timing of the Callback
- The callback occurs before OpenIM Server prepares to add a user to a group (if administrator approval is required, then before notifying the administrator).
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, and the method is POST |
https://callbackurl | Callback URL |
CallbackCommand | Fixed as: callbackBeforeApplyMemberJoinGroupCommand |
contenttype | Fixed value: JSON |
Header
Header Name | Example Value | Optional | Type | Description |
---|---|---|---|---|
operationID | 123456 | Required | string | operationID for global link tracing |
Request Packet Example
{
"callbackCommand": "CallbackBeforeApplyMemberJoinGroupCommand",
"groupID": "12345",
"userID": "user789",
"ex": "Extra data",
"groupEx": "GroupExtra data"
}
Request Packet Field Description
Object | Type | Description |
---|---|---|
callbackCommand | string | Callback command, here for pre-joining group member. |
operationID | string | Unique operation ID. |
userID | string | User ID of the user joining the group. |
groupID | string | Unique identifier for the group. |
ex | string | Additional data field. |
groupEx | string | Additional data field for the group. |
Response Packet Example
Permitting to Join
{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 0,
"roleLevel": "1",
"ex": "Some extra data"
}
Response Packet Field Description
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates if the callback was executed correctly by the business system. 0 means the operation was successful. |
errCode | 5001 | Custom error code, ranging between 5000-9999. Set when actionCode is not 0 and 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, set when actionCode is 0 , 1 means to refuse to proceed. |
roleLevel | string | Permission level of the user joining the group. |
ex | string | Additional data or information. |