Callback Before Applying to Join Group
Description
The App’s business server can use this callback to monitor and manage users' requests to join groups in real time, including intercepting join requests if needed.
Important Notes
- To enable the callback, you must configure the callback URL and turn on the switch for this specific callback protocol. For configuration details, refer to the Callback Introduction document.
- The callback is initiated from the OpenIM Server to the App backend as an HTTP/HTTPS POST request.
- The App business server must respond within the timeout period.
Scenarios that Trigger This Callback
- When a user sends a request to join a group from the client.
Timing of Callback
- OpenIM Server triggers this callback before adding the user to the group (if admin approval is required, it will trigger the callback before notifying the administrator).
Interface Description
Example Request URL
The CallbackCommand
here is: callbackBeforeJoinGroupCommand
{WEBHOOK_ADDRESS}/callbackBeforeJoinGroupCommand?contenttype=json
Example Request Package
{
"callbackCommand": "callbackBeforeJoinGroupCommand",
"groupID": "12345",
"groupType": 2,
"applyID": "user789",
"reqMessage": "hello",
"ex": "Extra data"
}
Request Package Field Descriptions
Field | Type | Description |
---|---|---|
callbackCommand | string | Callback command for a new member requesting to join the group. |
groupID | string | Unique identifier for the group. |
groupType | int | Group type, fixed at 2. |
applyID | string | ID of the user applying to join the group. |
reqMessage | string | Message attached with the request. |
ex | string | Additional data field. |
Example Response Package
Allow Join
{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 0
}
Response Package Field Descriptions
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates if the business system’s callback executed correctly. 0 indicates success. |
errCode | 5001 | Custom error code, ranging from 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 action code to execute; set to 1 to deny further action when actionCode equals 0 . |