Skip to main content

Friend Relationship Status Change Callback

When a user's friend relationship status changes, RC can synchronize the update results to your application server in real time.

Enable the Service

Before calling this API, enable the profile hosting service by submitting a ticket.

Callback Methods

Request method: POST

Data format: application/json

The RC IM server adds signature parameters to the POST request URL. You can verify the caller's identity and data validity through these signatures. For details, see Server Callback Signatures.

Callback parameters

The HTTP request body for the callback service uses application/json format and contains the following fields:

ParameterTypeRequiredDescription
eventTypeNumberYesEvent type:
1 Friend request sent
2 Friend request accepted
3 Friend request rejected
4 Friend removed
5 Server-added friend
userIdStringYesOperator's user ID
toUserIdStringYesTarget user ID
timeLongYesOperation timestamp
sourceStringYesOperation source (e.g. Android, iOS, HarmonyOS, Websocket, PC, MiniProgram, Server)
extraStringNoAdditional data for friend requests

Callback request example

If your callback URL is set to http://example.com/friend/sync.php, the request example would be:

POST /friend/sync HTTP/1.1
Host: example.com
Content-Type: application/json

{
"userId": "userId11",
"eventType": 3,
"toUserId": "toUserId22",
"source": "Android",
"extra": "XXXXXX",
"time": 1774363668900
}

Respond to callbacks

tip
  • The server considers the status synchronized when receiving a 200 OK response.
  • If the response times out after 5 seconds, the server retries twice. If still unsuccessful, it stops synchronizing this status.
  • If widespread timeouts occur, callback requests will pause for 1 minute before resuming. Network failures may delay synchronization by 5 minutes.