Through this callback, the app backend can monitor users’ group creation requests in real time. The backend can reject users’ requests for creating groups.
Perform the callback before the IM backend prepares to create a group.
In the following example, the callback URL configured by the app is https://www.example.com
.
Example:
https://www.example.com?SdkAppid=$SDKAppID&CallbackCommand=$CallbackCommand&contenttype=json&ClientIP=$ClientIP&OptPlatform=$OptPlatform
Parameter | Description |
---|---|
https | The request protocol is HTTPS, and the request method is POST. |
www.example.com | The callback URL. |
SdkAppid | The SDKAppID assigned by the IM console when an app is created. |
CallbackCommand | The value is fixed to Group.CallbackBeforeCreateGroup. |
contenttype | The value is fixed to JSON. |
ClientIP | The client IP address, such as 127.0.0.1. |
OptPlatform | The client platform. For information on possible values, see the parameter description for OptPlatform in Third-Party Callback Introduction: Callback Protocols. |
{
"CallbackCommand": "Group.CallbackBeforeCreateGroup", // Callback command
"Operator_Account": "leckie", // Operator
"Owner_Account": "leckie", // Group owner
"Type": "Public", // Group type
"Name": "MyFirstGroup", // Group name
"CreatedGroupNum": 123, //Number of groups of the same type already created by the user
"MemberList": [ // Initial member list
{
"Member_Account": "bob"
},
{
"Member_Account": "peter"
}
]
}
Field | Type | Feature |
---|---|---|
CallbackCommand | String | Callback command |
Operator_Account | String | UserID of the operator who initiates the group creation request |
Owner_Account | String | UserID of the owner of the group to be created through the request |
Type | String | The type of the group that generates group messages, such as Public. For details, see Group Types. |
Name | String | Name of the group to be created through the request |
CreatedNum | Integer | Number of groups of the same type already created by the user |
MemberList | Array | Initial member list of the group to be created through the request |
Allow the user to create the group.
{
"ActionStatus": "OK",
"ErrorInfo": "",
"ErrorCode": 0 // Allow to create
}
Reject the user’s request to create the group. In this case, the group will not be created, and error code 10016
will be returned to the invoker.
{
"ActionStatus": "OK",
"ErrorInfo": "",
"ErrorCode": 1 // Reject to create
}
Field | Type | Attribute | Description |
---|---|---|---|
ActionStatus | String | Required | The request processing result. OK: succeeded. FAIL: failed. |
ErrorCode | Integer | Required | The error code. 0: allow creation. 1: reject creation. |
ErrorInfo | String | Required | The error information. |
Was this page helpful?