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:
Parameter | Type | Required | Description |
---|---|---|---|
eventType | Number | Yes | Event type: • 1 Friend request sent• 2 Friend request accepted• 3 Friend request rejected• 4 Friend removed• 5 Server-added friend |
userId | String | Yes | Operator's user ID |
toUserId | String | Yes | Target user ID |
time | Long | Yes | Operation timestamp |
source | String | Yes | Operation source (e.g. Android, iOS, HarmonyOS, Websocket, PC, MiniProgram, Server) |
extra | String | No | Additional 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.