Skip to main content

Callback Before Member Joins Group

Description

The App business server can use this callback to monitor information when a member attempts to join a group, including intercepting user profile data such as avatar, nickname, user permissions, and additional information before they join.

Important Notes

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

Scenarios that Trigger This Callback

  • The group owner initiates the creation of a group chat via the App client.
  • The App administrator invites users to a group through the REST API.
  • The App administrator processes group join requests via the REST API.
  • A user joins a group via the App.

Timing of Callback

  • Before OpenIM Server prepares to create the group chat.
  • Before OpenIM Server approves a user joining the group.

Interface Description

Example Request URL

The CallbackCommand here is: callbackBeforeMembersJoinGroupCommand

{WEBHOOK_ADDRESS}/callbackBeforeMembersJoinGroupCommand?contenttype=json

Example Request Package

{
"callbackCommand": "callbackBeforeMembersJoinGroupCommand",
"groupID": "12345",
"memberList": [
{
"userID": "666",
"ex": "337845818, 3q"
},
{
"userID": "1028",
"ex": "Are U OK"
}
],
"groupEx": "test Group"
}

Request Package Field Descriptions

FieldTypeDescription
callbackCommandstringCallback command, indicating a pre-join member callback here.
groupIDstringUnique identifier of the group.
memberListarrayList of members who will join the group, including user ID and extra info fields.
memberList.userIDstringUser ID of the member.
memberList.exstringAdditional information for the member.
groupExstringAdditional information for the group.

Example Response Package

{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 0,
"memberCallbackList": [
{
"userID": "3034068043",
"nickname": "3q",
"faceURL": "http://203.56.175.233:10002/third/object?name=%2Fdata%2Fuser%2F0%2Fcn.rentsoft.flutter.openim.consumer%2Fcache%2Fimage_cropper_1687330588901.jpg",
"roleLevel": 20,
"muteEndTime": 0,
"ex": "Some extra data"
},
{
"userID": "3034068043",
"nickname": "President Lei",
"faceURL": "http://203.56.175.233:10002/third/object?name=%2Fdata%2Fuser%2F0%2Fcn.rentsoft.flutter.openim.consumer%2Fcache%2Fimage_cropper_1687330588901.jpg",
"roleLevel": 100,
"muteEndTime": 0,
"ex": "Some extra data"
}
]
}

Response Package Field Descriptions

FieldValueDescription
actionCode0Indicates if the callback executed successfully. 0 means success.
errCode5001Custom error code, ranging from 5000-9999. Set if actionCode is not 0.
errMsg"An error message"Simple error message corresponding to the custom error code.
errDlt"Detailed error information"Detailed error message for the custom error code.
nextCode1Next step directive. Set to 1 to stop further action when actionCode = 0.
memberCallbackListarrayCallback list for members joining the group.
memberCallbackList.userIDstringUser ID of the member.
memberCallbackList.nicknamestringNickname of the member.
memberCallbackList.faceURLstringURL for the member's profile picture.
memberCallbackList.roleLevelint32Role level of the member.
memberCallbackList.muteEndTimeint64Mute end time for the member.
memberCallbackList.exstringAdditional information for the member.