Skip to main content

Callback Before Updating User Information

Function Description

The App business server can use this callback to receive requests from users to update their personal information. Additionally, the business server can modify and intervene in the request.

Precautions

  • To enable the callback, it is necessary to configure the callback URL and activate the corresponding switch for this callback protocol. Configuration methods can be found in the Callback Explanation document.
  • The direction of the callback is an HTTP/HTTPS POST request initiated by OpenIMServer to the App backend.
  • After receiving the callback request, the App business server must verify whether the command parameter in the request URL is its SDKNAME parameter.
  • The APP business server must respond to this request within the timeout period.

Scenarios That May Trigger This Callback

  • App users update their personal information through the client.
  • App administrators update user information through the REST API.

Timing of the Callback

  • Before OpenIMServer prepares to update user information.

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

ParameterDescription
httpsRequest protocol is HTTPS, method is POST
https://callbackurlCallback URL
CallbackCommandFixed value: callbackBeforeUpdateUserInfoCommand
contenttypeFixed value: JSON
Header NameExample ValueMandatoryTypeDescription
operationID1646445464564RequiredstringoperationID for global link tracing

Request Packet Example

{
"callbackCommand": "callbackBeforeUpdateUserInfoCommand",
"userID": "user123",
"nickName": "John Doe",
"faceURL": "http://example.com/path/to/face/image.png",
"ex": "Extra data"
}

Request Packet Field Explanation

FieldTypeDescription
callbackCommandstringCallback command, here for before updating user information
userIDstringThe unique identifier of the user
nickNamestringThe nickname of the user
faceURLstringURL of the user's avatar
exstringAdditional data fields

Response Packet Example

Allow Update

Allows the user to update their information.

{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": "0",
"nickName": "John Doe Updated",
"faceURL": "http://example.com/new/face/image.png",
"ex": "Updated extra data"
}

Response Packet Field Explanation

FieldValueDescription
actionCode0Indicates if 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 not 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 instruction, 1 means to refuse to continue executing, set when actionCode is 0.
nickNamestringThe nickname of the user.
faceURLstringURL of the user's updated avatar.
exstringUpdated additional data fields.