Callback After a User Joins a Group
Function Description
The App business server can use this callback to real-time monitor messages about group members joining, including notifying the App backend about member joining. The App can use this for necessary data synchronization.
Precautions
- To enable the callback, you must configure the callback URL and activate the switch corresponding to this callback protocol. See the Callback Description document for configuration methods.
- The direction of the callback is an HTTP/HTTPS POST request initiated by OpenIM Server to the App backend.
- The App business server needs to verify whether the command parameter in the request URL is its own SDK parameter after receiving the callback request.
- The APP business server is required to respond to this request within the timeout period.
Scenarios That May Trigger This Callback
- App users apply to join a group through the client and get approved.
- App users successfully add other people to a group through the client.
- App administrators add users to a group through the REST API.
Timing of the Callback
- After a user actively applies and successfully joins a group.
- After a user is invited by other members and successfully joins a group.
- After a user is added to the group by administrators through the REST API.
Interface Description
Request URL Example
In the following example, the configured callback URL of the App is https://callbackurl
.
https://callbackurl?command=$CallbackCommand&contenttype=json
Request Parameter Description
Parameter | Description |
---|---|
https | Request protocol is HTTPS, request method is POST. |
https://callbackurl | Callback URL. |
CallbackCommand | Fixed value: callbackAfterMemberJoinGroupCommand. |
contenttype | Fixed value: JSON |
Header
Header Name | Example Value | Optional | Type | Description |
---|---|---|---|---|
operationID | 1646445464564 | Required | string | operationID used for global tracing |
Request Packet Example
{
"callbackCommand": "CallbackAfterMemberJoinGroupCommand",
"groupID": "12345",
"userID": "user789",
"ex": "Extra data",
"groupEx": "GroupExtra data"
}
Request Packet Field Description
Object | Type | Description |
---|---|---|
callbackCommand | string | Callback command, here for after a user joins the group. |
userID | string | User ID of the member joining the group. |
groupID | string | Unique identifier of the group. |
ex | string | Additional data field. |
groupEx | string | Additional data field for the group. |
Response Packet Example
After the App backend synchronizes the data, it sends a callback response packet.
{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": 1
}
Response Packet Field Description
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates whether the business system's callback was executed correctly. 0 means the operation was successful. |
errCode | 0 | Represents a custom error code, here 0 indicates ignoring 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 execution instruction, 1 means refuse to continue execution, set when actionCode is 0 . |