Skip to main content

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

ParameterDescription
httpsThe request protocol is HTTPS, and the method is POST.
https://callbackurlCallback URL
UserRegisterCommandFixed value: userRegisterBeforeCommand
contenttypeFixed 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

FieldTypeDescription
callbackCommandstringCallback command, here for pre-user registration callback.
secretstringInvitation code.
usersobjectUser information object.
userIDstringUnique identifier of the user.
nicknamestringNickname of the user.
faceURLstringURL of the user's avatar.
exstringAdditional data field.
createTimeint64Timestamp of user creation (milliseconds).
appMangerLevelint32User's management level.
globalRecvMsgOptint32User's global message reception option.
Header NameExample ValueOptionalTypeDescription
operationID1646445464564RequiredstringoperationID 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

FieldValueDescription
actionCode0Indicates whether the business system's callback was executed correctly. 0 means the operation was successful.
errCode5001Custom 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.
nextCode1Next step command.
usersobjectUser information object.
userIDstringUnique identifier of the user.
nicknamestringNickname of the user.
faceURLstringURL of the user's avatar.
exstringAdditional data field.
createTimeint64Timestamp of user creation (milliseconds).
appMangerLevelint32User's management level.
globalRecvMsgOptint32User's global message reception option.