App 后台可以通过该回调实时查看用户的加好友回应请求,包括:
即时通信 IM 后台收到来自 App 的加好友回应请求后。
注意:通过 REST API 发起的加好友回应请求不会触发回调。
以下示例中 App 配置的回调 URL 为 https://www.example.com
。
示例:
https://www.example.com?SdkAppid=$SDKAppID&CallbackCommand=$CallbackCommand&contenttype=json&ClientIP=$ClientIP&OptPlatform=$OptPlatform
参数 | 说明 |
---|---|
https | 请求协议为 HTTPS,请求方式为 POST |
www.example.com | 回调 URL |
SdkAppid | 创建应用时在即时通信 IM 控制台分配的 SDKAppID |
CallbackCommand | 固定为:Sns.CallbackPrevFriendResponse |
contenttype | 固定值为:json |
ClientIP | 客户端 IP,格式如:127.0.0.1 |
OptPlatform | 客户端平台,取值参见 第三方回调简介:回调协议 中 OptPlatform 的参数含义 |
{
"CallbackCommand": "Sns.CallbackPrevFriendResponse",
"Requester_Account": "id",
"From_Account": "id",
"ResponseFriendItem": [
{
"To_Account": "id1",
"Remark": "remark1",
"TagName": "group1",
"ResponseAction": "Response_Action_AgreeAndAdd"
},
{
"To_Account": "id2",
"Remark": "remark2",
"TagName": "group2",
"ResponseAction": "Response_Action_Reject"
}
],
"EventTime": 1631777645424
}
字段 | 类型 | 说明 |
---|---|---|
CallbackCommand | String | 回调命令 |
Requester_Account | String | 添加好友回应请求发起方的 UserID |
From_Account | String | 请求加好友回应的用户的 UserID |
ResponseFriendItem | Array | 加好友回应请求的参数 |
To_Account | String | 请求回应的用户的 UserID |
Remark | String | From_Account 对 To_Account 设置的好友备注,详情可参见 标配好友字段 |
TagName | String | From_Account 对 To_Account 设置的好友分组,详情可参见 标配好友字段 |
ResponseAction | String | 加好友回应方式: |
EventTime | Integer | 毫秒时间戳 |
{
"ActionStatus": "OK",
"ErrorCode": 0,
"ErrorInfo": "",
"ResultItem": [
{
"To_Account": "id1",
"ResultCode": 0,
"ResultInfo": ""
},
{
"To_Account": "id2",
"ResultCode": 0,
"ResultInfo": ""
}
]
}
字段 | 类型 | 属性 | 说明 |
---|---|---|---|
ActionStatus | String | 必填 | 请求处理的结果,OK 表示处理成功,FAIL 表示失败 |
ErrorCode | Integer | 必填 | 错误码: |
ErrorInfo | String | 必填 | 错误信息 |
ResultItem | Array | 必填 | App 后台的处理结果 |
To_Account | String | 必填 | 请求添加的用户的 UserID |
ResultCode | Integer | 必填 | 错误码: |
ResultInfo | String | 必填 | 错误信息 |
本页内容是否解决了您的问题?