Skip to main content

Callback Before Inviting New Members to Group

Description

The App business server can use this callback to monitor requests from group members to invite other users to join a group. The server can intercept and review these requests.

Important Notes

  • To enable this callback, configure the callback URL and activate the corresponding protocol switch. 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

  • An App user initiates a request to invite another user to a group through the client.
  • An App administrator adds a user to a group through the REST API.

Timing of Callback

  • The callback is triggered before OpenIM Server proceeds with adding the user to the group.

Interface Description

Example Request URL

The CallbackCommand here is: callbackBeforeInviteJoinGroupCommand

{WEBHOOK_ADDRESS}/callbackBeforeInviteJoinGroupCommand?contenttype=json

Example Request Package

{
"callbackCommand": "callbackBeforeInviteJoinGroupCommand",
"operationID": "1646445464564",
"groupID": "12345",
"reason": "friend",
"invitedUserIDs": ["user1","user2"]
}

Request Package Field Descriptions

FieldTypeDescription
callbackCommandstringCallback command, here indicating a pre-invite check.
operationIDstringOperation ID for global traceability.
groupIDstringUnique identifier of the group.
reasonstringReason for the invitation.
invitedUserIDsstring[]IDs of users to be added to the group.

Example Response Package

Approval Response

Approves the request to invite users to the group.

{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 0,
"invitedUserIDs": ["user1","user2"]
}

Response Package Field Descriptions

FieldValueDescription
actionCode0Indicates if the callback executed correctly. 0 means success.
errCode5001Custom error code, within the range 5000-9999, set when actionCode ≠ 0 or nextCode = 1.
errMsg"An error message"Simple error message corresponding to the custom error code.
errDlt"Detailed error information"Detailed error information for the custom error code.
nextCode1Next action instruction, set to 1 to stop further action when actionCode = 0.
invitedUserIDsstring[]IDs of users to be added to the group.