Callback Before User Registration Request
Function Description
The App business server can obtain the user registration request through this callback. Additionally, the business server can reject the user registration request, or modify and intervene in the request.
Notes
- To enable the callback, it is necessary to configure the callback URL and activate the switch corresponding to this callback protocol. For configuration methods, see the Callback Description document.
- The direction of the callback is an HTTP/HTTPS POST request initiated by OpenIM Server to the App backend.
- After receiving the callback request, the App business server needs to verify whether the command parameter in the request URL is their own SDKNAME parameter.
- The APP business server needs to respond to this request within the timeout period.
Scenarios That May Trigger This Callback
- New users registering an account through the client.
Timing of Callback
- When OpenIM Server receives a user registration request, before processing the user's request.
Interface Description
Request URL Example
In the following example, the callback URL configured by the App is https://callbackurl
.
https://callbackurl?command=$UserRegisterCommand&contenttype=json
Request Parameter Description
Parameter | Description |
---|---|
https | The request protocol is HTTPS, and the method is POST. |
https://callbackurl | Callback URL |
UserRegisterCommand | Fixed value: userRegisterBeforeCommand |
contenttype | Fixed value: JSON |
Request Package Example
{
"callbackCommand": "userRegisterBeforeCommand",
"secret": "YourSecretKey",
"users": {
"userID": "user123",
"nickname": "John Doe",
"faceURL": "http://example.com/path/to/face/image.png",
"ex": "Extra data",
"createTime": 1673048592000,
"appMangerLevel": 1,
"globalRecvMsgOpt": 1
}
}
Request Package Field Description
Field | Type | Description |
---|---|---|
callbackCommand | string | Callback command, here for pre-user registration callback. |
secret | string | Invitation code. |
users | object | User information object. |
userID | string | Unique identifier of the user. |
nickname | string | Nickname of the user. |
faceURL | string | URL of the user's avatar. |
ex | string | Additional data field. |
createTime | int64 | Timestamp of user creation (milliseconds). |
appMangerLevel | int32 | User's management level. |
globalRecvMsgOpt | int32 | User's global message reception option. |
Header
Header Name | Example Value | Optional | Type | Description |
---|---|---|---|---|
operationID | 1646445464564 | Required | string | operationID for global link tracing |
Response Package Example
Operation Successful
Example of a successful operation response.
{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": "0",
"users": {
"userID": "user123",
"nickname": "John Doe",
"faceURL": "http://example.com/path/to/face/image.png",
"ex": "Extra data",
"createTime": 1673048592000,
"appMangerLevel": 1,
"globalRecvMsgOpt": 1
}
}
Response Package Field Description
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates whether the business system's callback was executed correctly. 0 means the operation was successful. |
errCode | 5001 | Custom error code, ranging between 5000-9999. Set when actionCode is not 0; set when nextCode is 1. |
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 command. |
users | object | User information object. |
userID | string | Unique identifier of the user. |
nickname | string | Nickname of the user. |
faceURL | string | URL of the user's avatar. |
ex | string | Additional data field. |
createTime | int64 | Timestamp of user creation (milliseconds). |
appMangerLevel | int32 | User's management level. |
globalRecvMsgOpt | int32 | User's global message reception option. |