The app backend uses this callback to view information about friends added by users in real time.
This callback is triggered when a friend is successfully added.
Note:This callback will not be triggered if the API for importing friends is invoked to add a friend.
In the following example, the callback URL configured in the app is https://www.example.com
.
Example:
https://www.example.com?SdkAppid=$SDKAppID&CallbackCommand=$CallbackCommand&contenttype=json&ClientIP=$ClientIP&OptPlatform=$OptPlatform
Parameter | Description |
---|---|
https | The request protocol is HTTPS, and the request method is POST. |
www.example.com | The callback URL. |
SdkAppid | The SDKAppID assigned by the IM console when an app is created. |
CallbackCommand | The value is fixed to Sns.CallbackFriendAdd. |
contenttype | The value is fixed to JSON. |
ClientIP | The client IP address, whose format is similar to: 127.0.0.1. |
OptPlatform | The client platform. For details on the possible values, see the OptPlatform parameter in Third-Party Callback Overview: Callback Protocols. |
{
"CallbackCommand": "Sns.CallbackFriendAdd",
"PairList": [
{
"From_Account": "id",
"To_Account": "id1",
"Initiator_Account": "id"
},
{
"From_Account": "id",
"To_Account": "id2",
"Initiator_Account": "id"
},
{
"From_Account": "id",
"To_Account": "id3",
"Initiator_Account": "id"
}
],
"ClientCmd":"friend_add",
"Admin_Account":"",
"ForceFlag":1
}
Field | Type | Description |
---|---|---|
CallbackCommand | String | The callback command. |
PairList | Array | The friend pair that is successfully added. |
From_Account | String | From_Account adds To_Account to the friend list. |
To_Account | String | To_Account is added to the friend list of From_Account. |
Initiator_Account | String | The UserID of the user who initiates the friend addition request. |
ClientCmd | String | The command keyword that triggers the callback: For a friend addition request, valid values are friend_add and FriendAdd. For a friend addition response, valid values are friend_response and FriendResponse. |
Admin_Account | String | If the current request is a friend addition request triggered by the backend, this field is set to the admin account. Otherwise, this field is empty. |
ForceFlag | Integer | The flag for forcibly adding a friend by the admin. 1: the friend is added forcibly. 0: the friend is added as normal. |
{
"ActionStatus": "OK",
"ErrorCode": 0,
"ErrorInfo": ""
}
Field | Type | Attribute | Description |
---|---|---|---|
ActionStatus | String | Required | The request processing result. OK: succeeded. FAIL: failed. |
ErrorCode | Integer | Required | The error code. 0 indicates that the app backend processing succeeded, and 1 indicates that the app backend processing failed. |
ErrorInfo | String | Required | Error information. |
Was this page helpful?