Skip to main content

Callback After Agreeing To Add Friend

Functional Description

The App backend can view users' newly added 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 agrees to a friend request.

Timing of Callback

  • Triggered after OpenIM Server successfully adds a friend.

Interface Description

Request URL Example

Here CallbackCommand is: callbackAfterAddFriendCommand

{WEBHOOK_ADDRESS}/callbackAfterAddFriendCommand?contenttype=json

Request Package Example

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

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
handleMsgstringAdditional message when handling the friend request
handleResultint32Result of the friend request handling

Response Package Example

Handling Result

The result of processing a user's request to agree to add a friend.

{
"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.