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
Field | Type | Description |
---|---|---|
callbackCommand | string | Callback command for 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
The App backend sends the following response package after synchronizing data.
{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 1
}
Response Package Field Descriptions
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates if the callback was executed correctly. 0 means success. |
errCode | 0 | Custom 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. |
nextCode | 1 | Next action code, set to 1 to halt further action if actionCode is 0 . |