Skip to main content

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

FieldTypeDescription
callbackCommandstringCallback command for a new member requesting to join the group.
groupIDstringUnique identifier for the group.
groupTypeintGroup type, fixed at 2.
applyIDstringID of the user applying to join the group.
reqMessagestringMessage attached with the request.
exstringAdditional data field.

Example Response Package

Allow Join

{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 0
}

Response Package Field Descriptions

FieldValueDescription
actionCode0Indicates if the business system’s callback executed correctly. 0 indicates success.
errCode5001Custom 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.
nextCode1Next action code to execute; set to 1 to deny further action when actionCode equals 0.