This API is used by the app backend to:
SDKAppID
contained in the request URL is the SDKAppID
of the app.The IM backend receives a friend request from the app.
Note:Friend requests initiated via RESTful API calls will not trigger the callback.
In the following sample, the callback URL configured in the app is https://www.example.com
.
Sample:
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 | Callback URL |
SdkAppid | SDKAppID assigned by the IM console when the app is created |
CallbackCommand | Always Sns.CallbackPrevFriendAdd |
contenttype | Always json |
ClientIP | Client IP, such as 127.0.0.1 |
OptPlatform | Client platform. For valid values, see the description of OptPlatform in the Callback Protocols section of Third-Party Callback Overview. |
{
"CallbackCommand": "Sns.CallbackPrevFriendAdd",
"Requester_Account": "id",
"From_Account": "id",
"FriendItem": [
{
"To_Account": "id1",
"Remark": "remark1",
"GroupName": "group1",
"AddSource": "AddSource_Type_Android",
"AddWording": "this is id1!"
},
{
"To_Account": "id2",
"Remark": "remark2",
"GroupName": "group1",
"AddSource": "AddSource_Type_Android",
"AddWording": "this is id2!"
}
],
"AddType": "Add_Type_Both",
"ForceAddFlags": 0,
"EventTime": 1631777344870
}
Field | Type | Description |
---|---|---|
CallbackCommand | String | Callback command |
Requester_Account | String | UserID of the user who initiates the request |
From_Account | String | UserID of the user who requests to add friend |
FriendItem | Array | Parameter of the friend request |
To_Account | String | UserID of user to be added as friend |
Remark | String | Friend remarks set by From_Account for To_Account . For more information, see the Standard friend fields section in Relationship Chain Management. |
GroupName | String | Friend list set by From_Account for To_Account . For more information, see the Standard friend fields section in Relationship Chain Management. |
AddSource | String | Source from which a friend is added. For more information, see the Standard friend fields section in Relationship Chain Management. |
AddWording | String | Friend request content. For more information, see the Standard friend fields section in Relationship Chain Management. |
AddType | String | Friend adding mode. Valid values: Add_Type_Single : one-wayAdd_Type_Both (default): two-way |
ForceAddFlags | Integer | Flag denoting the friend is force added by an admin. Valid values:1 : force adding0 : normal adding |
EventTime | Integer | Timestamp in milliseconds |
{
"ActionStatus": "OK",
"ErrorCode": 0,
"ErrorInfo": "",
"ResultItem": [
{
"To_Account": "id1",
"ResultCode": 0,
"ResultInfo": ""
},
{
"To_Account": "id2",
"ResultCode": 0,
"ResultInfo": ""
}
]
}
Field | Type | Required | Description |
---|---|---|---|
ActionStatus | String | Yes | Request result. OK : successful; FAIL : failed |
ErrorCode | Integer | Yes | Error code. Valid values:0 : processing by the app backend is successful. |
ErrorInfo | String | Yes | Error information |
ResultItem | Array | Yes | Processing result from the app backend |
To_Account | String | Yes | UserID to be added as friend |
ResultCode | Integer | Yes | Result code. Valid values:0 : allow adding as friend. |
ResultInfo | String | Yes | Error information |
Was this page helpful?