tencent cloud

Chat

製品の説明
製品の概要
Basic Concepts
ユースケース
機能概要
アカウントシステム
ユーザープロフィールとリレーションシップチェーン
メッセージ管理
グループシステム
Official Account
Audio/Video Call
使用制限
購入ガイド
課金概要
価格説明
Purchase Instructions
Renewal Guide
支払い延滞説明
Refund Policy
ダウンロードセンター
SDK & Demo ソースコード
更新ログ
シナリオプラン
Live Streaming Setup Guide
AI Chatbot
極めて大規模なエンターテインメントコラボレーションコミュニティ
Discord実装ガイド
ゲーム内IM統合ガイド
WhatsApp Channel-style Official Account Integration Solution
Send Red Packet
Firewall Restrictions
クライアントAPIs
SDK API(Web)
Android
iOS & macOS
Swift
Flutter
SDK API(Electron)
SDK APIs (Unity)
SDK API(React Native)
C APIs
C++
サービス側 APIs
UserSigの生成
RESTful APIs
Webhooks
コンソールガイド
New Console Introduction
アプリケーションの作成とアップグレード
基本設定
機能設定
アカウント管理
グループ管理
Official Channel Management
コールバック設定
監視ダッシュボード
Viewing Guide for Resource Packages
Real-Time Monitor
補助ツールの開発
アクセス管理
Advanced Features
よくあるご質問
uni-app FAQs
 購入に関する質問
SDKに関する質問
アカウント認証に関する質問
ユーザープロファイルとリレーションシップチェーンに関する質問
メッセージに関する質問
グループに関する質問
ライブ配信グループに関する質問
ニックネームプロフィール画像に関連した問題
一般的なリファレンス
Service Level Agreement
セキュリティコンプライアンス認証
IM ポリシー
プライバシーポリシー
データプライバシーとセキュリティ契約
エラーコード
お問い合わせ

After a Friend Is Added

PDF
フォーカスモード
フォントサイズ
最終更新日: 2024-08-20 17:11:03

Feature Description

The app backend uses this callback to view information about friends added by users in real time.

Notes

To enable this callback, you must configure the callback URL and toggle on the corresponding protocol. For details on the configuration method, see Third-Party Callback Configuration.
Callback direction: the Chat backend initiates an HTTP POST request to the app backend.
After receiving the callback request, the app backend must check whether the SDKAppID contained in the request URL is consistent with its own SDKAppID.
For other security-related issues, see Third-Party Callback Overview: Security Considerations.

Callback Triggering Scenarios

The app backend uses the RESTful API to initiate a two-way friend addition request, and the peer’s friend request verification mode is "AllowAny".
The app backend uses the client to initiate a two-way friend addition request, and the peer’s friend verification mode is "AllowAny".
The app backend uses the RESTful API to initiate a one-way friend addition request.
The app backend uses the client to initiate a one-way friend addition request.
After receiving the friend addition request, the app user permits to add the peer as a friend.
The app backend uses the RESTful API to forcibly add a friend.

Callback Triggering Time

This callback is triggered when a friend is successfully added.
Caution:
This callback will not be triggered if the API for importing friends is invoked to add a friend.

API Description

Request URL example

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

Request parameters

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 Chat 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.

Request packet example

{
"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
}

Request packet fields

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.

Response packet example

{
"ActionStatus": "OK",
"ErrorCode": 0,
"ErrorInfo": ""
}

Response packet fields

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.

References

RESTful APIs: Adding a friend

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック