Callback Before Group Creation
Description
The App’s business server can use this callback to review requests from users to create groups. The server can either allow the request, reject it, or modify it as needed.
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
- Group creation requests from an App user through the client.
- Group creation requests from an App admin via REST API.
Timing of Callback
- Triggered before the OpenIM Server prepares to create the group.
Interface Description
Example Request URL
The CallbackCommand
here is: callbackBeforeCreateGroupCommand
{WEBHOOK_ADDRESS}/callbackBeforeCreateGroupCommand?contenttype=json
Example Request Package
{
"callbackCommand": "callbackBeforeCreateGroupCommand",
"groupID": "12345",
"groupName": "MyGroup",
"notification": "Welcome to MyGroup!",
"introduction": "This is a group for discussing example topics.",
"faceURL": "http://example.com/path/to/face/image.png",
"ownerUserID": "user123",
"createTime": 1673048592000,
"memberCount": 10,
"ex": "Extra data",
"status": 1,
"creatorUserID": "user123",
"groupType": 1,
"needVerification": 1,
"lookMemberInfo": 1,
"applyMemberFriend": 0,
"notificationUpdateTime": 1673048592000,
"notificationUserID": "user456",
"initMemberList": [
{
"userID": "user789",
"roleLevel": 60
},
{
"userID": "user101112",
"roleLevel": 20
}
]
}
Request Package Field Descriptions
Field | Type | Description |
---|---|---|
callbackCommand | string | Callback command for pre-group creation. |
groupID | string | Unique identifier for the group. |
groupName | string | Name of the group. |
notification | string | Group notification message. |
introduction | string | Group introduction. |
faceURL | string | URL for the group’s icon. |
ownerUserID | string | User ID of the group owner. |
createTime | int64 | Timestamp for when the group was created (in ms). |
memberCount | uint32 | Number of members in the group. |
ex | string | Additional data field. |
status | int32 | Group status. |
creatorUserID | string | User ID of the group creator. |
groupType | int32 | Group type, fixed at 2. |
needVerification | int32 | Whether verification is needed to join the group. |
lookMemberInfo | int32 | Whether group members’ information is visible. |
applyMemberFriend | int32 | Whether members can add each other as friends. |
notificationUpdateTime | int64 | Timestamp for when the notification was last updated (in ms). |
notificationUserID | string | User ID of the person who updated the notification. |
initMemberList | array | List of initial group members, each with userID and roleLevel fields. |
initMemberList.userID | string | User ID of the initial group member. |
initMemberList.roleLevel | int32 | Role level of the initial group member. |
Example Response Package
Allow Creation
{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 0,
"groupID": "G001",
"groupName": "MyGroup",
"notification": "Welcome to MyGroup!",
"introduction": "A group for discussions",
"faceURL": "http://example.com/groupface.png",
"ownerUserID": "user01",
"ex": "Some extra data",
"status": 1,
"creatorUserID": "user02",
"groupType": 1,
"needVerification": 0,
"lookMemberInfo": 1,
"applyMemberFriend": 1
}
Response Package Field Descriptions
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates if the callback was executed correctly. 0 means success. |
errCode | 5001 | Custom error code, ranging between 5000-9999. Set if actionCode is not 0 or nextCode is 1. |
errMsg | "An error message" | Simple error message for the custom error code. |
errDlt | "Detailed error information" | Detailed error information for the custom error code. |
nextCode | 1 | Next action code, set to 1 to halt further action if actionCode is 0 . |
groupID | string | Unique identifier for the group. |
groupName | string | Group name. |
notification | string | Notification or announcement for the group. |
introduction | string | Group introduction. |
faceURL | string | URL for the group’s icon or image. |
ownerUserID | string | User ID of the group owner. |
ex | string | Additional data or information. |
status | int32 | Group status. |
creatorUserID | string | User ID of the person creating the group. |
groupType | int32 | Group type, fixed at 2. |
needVerification | int32 | Whether verification is needed to join the group. |
lookMemberInfo | int32 | Whether group members’ information is visible. |
applyMemberFriend | int32 | Whether members can add each other as friends. |