Skip to main content

Callback After Sending Friend Request

Functional Description

The App backend can view users' new friend verification messages in real-time through this callback.

Precautions

  • To enable the callback, you must configure the callback URL and turn on the switch corresponding to this callback protocol. See the Callback Description document for configuration methods.
  • The callback direction is an HTTP/HTTPS POST request initiated by OpenIM Server to the App backend.
  • The APP business server must respond to this request within the timeout period.

Scenarios That May Trigger This Callback

  • After an App user receives a friend request.

Timing of Callback

  • Triggered after OpenIM Server successfully sends a friend request.

Interface Description

Request URL Example

Here CallbackCommand is: callbackAfterAddFriendCommand

{WEBHOOK_ADDRESS}/callbackAfterAddFriendCommand?contenttype=json

Request Package Example

{
"callbackCommand": "callbackAfterAddFriendCommand",
"fromUserID": "user123",
"toUserID": "user456",
"reqMsg": "Let's be friends!"
}

Request Package Field Description

ObjectTypeDescription
callbackCommandstringCallback command, here it is the callback after agreeing to add a friend
fromUserIDstringUser ID originating the friend request
toUserIDstringUser ID receiving the friend request
reqMsgstringAdditional message when requesting to add a friend

Response Package Example

Operation Successful

Example of a successful operation response.

{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": "1"
}

Response Package Field Description

FieldValueDescription
actionCode0Indicates whether the business system callback was executed correctly. 0 means the operation was successful.
errCode20001Custom error code, ranges from 20001-29999. 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 execution instruction, 1 means refusing to continue execution, set when actionCode is 0.