Skip to main content

Callback After Group Creation

Description

The App’s business server can use this callback to monitor information about newly created groups in real time, including notifications to the App backend that a group was created successfully. This allows the backend to perform data synchronization and other operations.

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

  • Successful group creation by an App user through the client.
  • Successful group creation by an App admin via REST API.

Timing of Callback

  • Triggered after the OpenIM Server successfully creates a group.

Interface Description

Example Request URL

The CallbackCommand here is: callbackAfterCreateGroupCommand

{WEBHOOK_ADDRESS}/callbackAfterCreateGroupCommand?contenttype=json

Example Request Package

{
"callbackCommand": "callbackAfterCreateGroupCommand",
"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

FieldTypeDescription
callbackCommandstringCallback command for group creation.
groupIDstringUnique identifier for the group.
groupNamestringName of the group.
notificationstringGroup notification message.
introductionstringGroup introduction.
faceURLstringURL for the group’s icon.
ownerUserIDstringUser ID of the group owner.
createTimeint64Timestamp for when the group was created (in ms).
memberCountuint32Number of members in the group.
exstringAdditional data field.
statusint32Group status.
creatorUserIDstringUser ID of the group creator.
groupTypeint32Group type, fixed at 2.
needVerificationint32Whether verification is needed to join the group.
lookMemberInfoint32Whether group members’ information is visible.
applyMemberFriendint32Whether members can add each other as friends.
notificationUpdateTimeint64Timestamp for when the notification was last updated (in ms).
notificationUserIDstringUser ID of the person who updated the notification.
initMemberListarrayList of initial group members, each with userID and roleLevel fields.
initMemberList.userIDstringUser ID of the initial group member.
initMemberList.roleLevelint32Role level of the initial group member.

Example Response Package

The App backend sends the following response package after synchronizing data.

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

Response Package Field Descriptions

FieldValueDescription
actionCode0Indicates if the callback was executed correctly. 0 means success.
errCode0Custom error code. Set to 0 to ignore callback results.
errMsg"An error message"Simple error message for the custom error code.
errDlt"Detailed error information"Detailed error information for the custom error code.
nextCode1Next action code, set to 1 to halt further action if actionCode is 0.