Skip to main content

Friendship status change callback

Nexconn can sync friendship status changes to your app server in real time when a user's friendship changes.

Callback method

Request Method: POST

Data Format: application/json

The Nexconn IM server appends signature parameters to the POST request URL. You can verify the caller's identity and data integrity using the signature. See Server Callback Signature.

Callback body parameters

The callback HTTP request body is in 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 = friend added directly by server.
userIdStringYesThe user ID who performed the action.
toUserIdStringYesThe target user ID.
timeLongYesOperation timestamp.
sourceStringYesOperation source (e.g., Android, iOS, HarmonyOS, Websocket, PC, MiniProgram, Server).
extraStringNoExtended data attached to the friend request.

Callback request example

Assuming your callback URL is http://example.com/friend/sync.php:

HTTP
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
}

Responding to callbacks

tip
  • Any HTTP 200 OK response is considered a successful sync.
  • If a response times out (5 seconds), Nexconn retries up to 2 more times. If all retries fail, this event is not resent.
  • If many timeouts occur in a short period, Nexconn temporarily pauses requests to your server and resumes after 1 minute. Disconnections due to network issues may delay sync by up to 5 minutes.