Callback After Creating a Group
Function Description
The App business server can view information about user-created groups in real-time through this callback. This includes notifying the App backend of successful group creations, allowing for data synchronization and other operations.
Precautions
- To enable the callback, a callback URL must be configured, and the switch corresponding to this callback protocol must be turned on. For configuration methods, refer to the Callback Description document.
- The callback direction is an HTTP/HTTPS POST request initiated by OpenIM Server to the App backend.
- The App business server, upon receiving the callback request, needs to verify if the command parameter in the request URL is their SDK parameter.
- The APP business server needs to respond to this request within the timeout period.
Scenarios That May Trigger This Callback
- App users successfully create a group through the client.
- App administrators successfully create a group through the REST API.
Timing of the Callback
- After OpenIM Server successfully creates a group.
Interface Description
Request URL Example
In the following example, the callback URL configured by the App is https://callbackurl
.
https://callbackurl?command=$CallbackCommand&contenttype=json
Request Parameter Description
Parameter | Description |
---|---|
https | Request protocol is HTTPS, and the method is POST |
https://callbackurl | Callback URL |
CallbackCommand | Fixed value: callbackAfterCreateGroupCommand |
contenttype | Fixed value: JSON |
Header
Header Name | Example Value | Optional | Type | Description |
---|---|---|---|---|
operationID | 1646445464564 | Required | string | operationID for global link tracing |
Request Packet Example
{
"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 Packet Field Description
Object | Type | Description |
---|---|---|
callbackCommand | string | Callback command, here for post-group creation. |
groupID | string | Unique identifier of the group. |
groupName | string | Name of the group. |
notification | string | Notification message of the group. |
introduction | string | Introduction of the group. |
faceURL | string | URL of the group's icon. |
ownerUserID | string | User ID of the group owner. |
createTime | int64 | Timestamp of group creation (milliseconds). |
memberCount | uint32 | Number of members in the group. |
ex | string | Additional data field. |
status | int32 | Status of the group. |
creatorUserID | string | User ID of the group creator. |
groupType | int32 | Type of the group. |
needVerification | int32 | Whether verification is needed to join the group. |
lookMemberInfo | int32 | Whether group member information is viewable. |
applyMemberFriend | int32 | Whether group members can apply to be friends. |
notificationUpdateTime | int64 | Timestamp of the last group notification update (milliseconds). |
notificationUserID | string | User ID of the person updating the notification. |
initMemberList | array | Initial list of group members, including userID and roleLevel fields. |
initMemberList.userID | string | User ID of initial members. |
initMemberList.roleLevel | int32 | Role level of initial members. |
Response Packet Example
The App backend sends a callback response packet after syncing data.
{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": 1
}
Response Packet Field Description
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates if the callback was executed correctly by the business system. 0 means the operation was successful. |
errCode | 0 | Custom error code, 0 here means to ignore the callback result. |
errMsg | "An error message" | Simple error message corresponding to the custom error code. |
errDlt | "Detailed error information" | Detailed error information corresponding to the custom error code. |
nextCode | 1 | Next step instruction, 1 means to refuse to proceed, set when actionCode is 0 . |