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 ポリシー
プライバシーポリシー
データプライバシーとセキュリティ契約
エラーコード
お問い合わせ
ドキュメントChatシナリオプランWhatsApp Channel-style Official Account Integration Solution

WhatsApp Channel-style Official Account Integration Solution

PDF
フォーカスモード
フォントサイズ
最終更新日: 2025-06-20 16:15:49
Our Official channel solution provides subscription-based communication and content distribution services, which is similar to WhatsApp channel's capabilities. Through integrated APIs, enterprises can create and manage verified organizational accounts; Publish articles, rich-media messages, and interactive content; Interact with subscribers and subscribers can also send messages to the Official channel; Monitor operational metrics through REST APIs and third-party callback systems.
Use case :
Brand-owned channels on WhatsApp Business that enable direct customer communication through multimedia messaging (text, images, videos) and service integration.The following are three common use cases of our Official channel:
Real-time Information Broadcast: Direct delivery of news, educational content, and updates to user feeds.
Brand Enhancement:Build recognition and influence through curated multimedia messaging.
Services Integration:Enable transactions (e.g. bank transfers).

The Official channel solution helps businesses generate revenue from their official accounts by optimizing the entire process—from attracting social media users, to establishing direct communication channels, and ultimately converting them into sales revenue.

Overview

An official channel can send broadcast messages to subscribed users and also engage in one-on-one chats with them.
When messages are exchanged, a one-on-one conversation is generated, with the conversationID structured as c2c_officialAccountID.
For management features such as creating an official channel, refer to the server APIs. The IMSDK primarily provides functionalities such as subscribing to an official channel, unsubscribing from an official channel, and retrieving the list of official channels.
Note:
This feature is supported only by the Enhanced edition on v7.6.5011 or later.

Official channel Profile Class Introduction

Attribute
Definition
Description
officialAccountID
official channel ID
The ​official channel ID must be prefixed with @TOA#_, can be customized, and has a maximum length of ​48 bytes.
officialAccountName
official channel name
Maximum Length: 150 bytes (UTF-8 encoded, where 1 Chinese character occupies 3 bytes)
faceUrl
Profile photo of the official channel
Maximum Length: 500 bytes
organization
organization name
Maximum Length: 500 bytes (UTF-8 encoded, where 1 Chinese character occupies 3 bytes)
introduction
Introduction of the official channel
Maximum Length: 400 bytes (UTF-8 encoded, where 1 Chinese character occupies 3 bytes)
customData
custom data
Maximum Length: 3000 bytes
createTime
Creation time of the official channel
Unit: Seconds
subscriberCount
The number of subscribed users
The number of active subscribers to the official channel
subscribeTime
The time when the logged-in user subscribed
Unit: Seconds

Subscribe to an Official channel

To subscribe to an official channel, call the subscribeOfficialAccount method (Java / Swift / Objective-C / C++) and pass the officialAccountID as the parameter.
1. Upon successful subscription, subscribers will receive the onOfficialAccountSubscribed callback notification (Java / Swift / Objective-C / C++) .
2. When the subscribed official channel's profile is modified via server API, subscribers will receive the onOfficialAccountInfoChanged callback notification (Java / Swift / Objective-C / C++) .
3. When the subscribed official channel is deleted via server API, subscribers will receive the onOfficialAccountDeleted callback notification (Java / Swift / Objective-C / C++).
Sample code:
Java
Swift
Objective-C
C++
V2TIMManager.getFriendshipManager().subscribeOfficialAccount("official_test", new V2TIMCallback() {
@Override
public void onSuccess() {
}

@Override
public void onError(int code, String desc) {
}
});

V2TIMManager.getFriendshipManager().addFriendListener(new V2TIMFriendshipListener() {
@Override
public void onOfficialAccountSubscribed(V2TIMOfficialAccountInfo officialAccountInfo) {
}

@Override
public void onOfficialAccountDeleted(String officialAccountID) {
}

@Override
public void onOfficialAccountInfoChanged(V2TIMOfficialAccountInfo officialAccountInfo) {
}
});
V2TIMManager.shared.subscribeOfficialAccount(officialAccountID: "officialAccountID") {
print("subscribeOfficialAccount succ")
} fail: { code, desc in
print("subscribeOfficialAccount fail, \\(code), \\(desc)")
}
V2TIMManager.shared.addFriendListener(listener: self)

func onOfficialAccountSubscribed(officialAccountInfo: V2TIMOfficialAccountInfo) {
print("officialAccountInfo:\\(officialAccountInfo.description)");
}

func onOfficialAccountDeleted(officialAccountID: String) {
print("officialAccountID:\\(officialAccountID)");
}

func onOfficialAccountInfoChanged(officialAccountInfo: V2TIMOfficialAccountInfo) {
print("officialAccountInfo:\\(officialAccountInfo.description)");
}
[[V2TIMManager sharedInstance] subscribeOfficialAccount:@"official_test" succ:^ {
NSLog(@"success");
} fail:^(int code, NSString *desc) {
NSLog(@"fail, code: %d, msg: %@", code, msg);
}];

[[V2TIMManager sharedInstance] addFriendListener:self];

- (void)onOfficialAccountSubscribed:(V2TIMOfficialAccountInfo *)officialAccountInfo {
}

- (void)onOfficialAccountDeleted:(NSString *)officialAccountID {
}

- (void)onOfficialAccountInfoChanged:(V2TIMOfficialAccountInfo *)officialAccountInfo {
}
template <class T>
class ValueCallback final : public V2TIMValueCallback<T> {
public:
using SuccessCallback = std::function<void(const T&)>;
using ErrorCallback = std::function<void(int, const V2TIMString&)>;
ValueCallback() = default;
~ValueCallback() override = default;
void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {
success_callback_ = std::move(success_callback);
error_callback_ = std::move(error_callback);
}
void OnSuccess(const T& value) override {
if (success_callback_) {
success_callback_(value);
}
}
void OnError(int error_code, const V2TIMString& error_message) override {
if (error_callback_) {
error_callback_(error_code, error_message);
}
}

private:
SuccessCallback success_callback_;
ErrorCallback error_callback_;
};

auto callback = new Callback;
callback->SetCallback(
[=]() {
delete callback;
},
[=](int error_code, const V2TIMString& error_message) {
delete callback;
});
V2TIMManager::GetInstance()->GetFriendshipManager()->SubscribeOfficialAccount(
"official_test", callback);

class FriendshipListener final : public V2TIMFriendshipListener {
public:
FriendshipListener() = default;
~FriendshipListener() override = default;
void OnOfficialAccountSubscribed(const V2TIMOfficialAccountInfo &info) override {
}
void OnOfficialAccountDeleted(const V2TIMString &officialAccountID) override {
}
void OnOfficialAccountInfoChanged(const V2TIMOfficialAccountInfo &info) override {
}
};

FriendshipListener friendshipListener;
V2TIMManager::GetInstance()->AddFriendshipListener(&friendshipListener);

Unsubscribe from an Official channel

To unsubscribe from an official channel, call the unsubscribeOfficialAccount method (Java / Swift / Objective-C / C++) and pass the officialAccountID as the parameter.
After successful unsubscription, the user will receive an onOfficialAccountUnsubscribed callback notification(Java / Swift / Objective-C / C++).
Sample code:
Java
Swift
Objective-C
C++
V2TIMManager.getFriendshipManager().unsubscribeOfficialAccount("official_test", new V2TIMCallback() {
@Override
public void onSuccess() {
}
@Override
public void onError(int code, String desc) {
}
});

V2TIMManager.getFriendshipManager().addFriendListener(new V2TIMFriendshipListener() {
@Override
public void onOfficialAccountUnsubscribed(String officialAccountID) {
}
});
V2TIMManager.shared.unsubscribeOfficialAccount(officialAccountID: "officialAccountID") {
print("unsubscribeOfficialAccount succ")
} fail: { code, desc in
print("unsubscribeOfficialAccount fail, \\(code), \\(desc)")
}

V2TIMManager.shared.addFriendListener(listener: self)

func onOfficialAccountUnsubscribed(officialAccountID: String) {
print("officialAccountID:\\(officialAccountID)");
}
[[V2TIMManager sharedInstance] unsubscribeOfficialAccount:@"official_test" succ:^ {
NSLog(@"success");
} fail:^(int code, NSString *desc) {
NSLog(@"fail, code: %d, msg: %@", code, msg);
}];

[[V2TIMManager sharedInstance] addFriendListener:self];

- (void)onOfficialAccountUnsubscribed:(V2TIMOfficialAccountInfo *)officialAccountInfo {
}
template <class T>
class ValueCallback final : public V2TIMValueCallback<T> {
public:
using SuccessCallback = std::function<void(const T&)>;
using ErrorCallback = std::function<void(int, const V2TIMString&)>;
ValueCallback() = default;
~ValueCallback() override = default;
void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {
success_callback_ = std::move(success_callback);
error_callback_ = std::move(error_callback);
}
void OnSuccess(const T& value) override {
if (success_callback_) {
success_callback_(value);
}
}
void OnError(int error_code, const V2TIMString& error_message) override {
if (error_callback_) {
error_callback_(error_code, error_message);
}
}

private:
SuccessCallback success_callback_;
ErrorCallback error_callback_;
};

auto callback = new Callback;
callback->SetCallback(
[=]() {
delete callback;
},
[=](int error_code, const V2TIMString& error_message) {
delete callback;
});
V2TIMManager::GetInstance()->GetFriendshipManager()->UnsubscribeOfficialAccount(
"official_test", callback);

class FriendshipListener final : public V2TIMFriendshipListener {
public:
FriendshipListener() = default;
~FriendshipListener() override = default;

void OnOfficialAccountUnsubscribed(const V2TIMString &officialAccountID) override {
}
};

FriendshipListener friendshipListener;
V2TIMManager::GetInstance()->AddFriendshipListener(&friendshipListener);

Get Official channel List

Call the getOfficialAccountsInfo interface (Java / Swift / Objective-C / C++) to retrieve the official channel list.
When the officialAccountIDList is empty, it returns the list of subscribed official channels.
When specific official channel IDs are provided in officialAccountIDList, it returns information for those specified official channels.
Sample code:
Java
Swift
Objective-C
C++
List<String> officialAccountIDList = new ArrayList<>();
V2TIMManager.getFriendshipManager().getOfficialAccountsInfo(officialAccountIDList, new V2TIMValueCallback<List<V2TIMOfficialAccountInfoResult>>() {
@Override
public void onSuccess(List<V2TIMOfficialAccountInfoResult> v2TIMOfficialAccountInfoResults) {
}

@Override
public void onError(int code, String desc) {
}
});
V2TIMManager.shared.getOfficialAccountsInfo(officialAccountIDList: ["officialAccountID"]) { officialAccountResultList in
officialAccountResultList.forEach { item in
print(item.description)
}
} fail: { code, desc in
print("getOfficialAccountsInfo fail, \\(code), \\(desc)")
}
[[V2TIMManager sharedInstance] getOfficialAccountsInfo:nil succ:^(NSArray<V2TIMOfficialAccountInfoResult *> *resultList) {
[self appendString:[NSString stringWithFormat:@"success:%@", resultList]];
} fail:^(int code, NSString *desc) {
[self appendString:[NSString stringWithFormat:@"fail,code:%d msg:%@",code,desc]];
}];
template <class T>
class ValueCallback final : public V2TIMValueCallback<T> {
public:
using SuccessCallback = std::function<void(const T&)>;
using ErrorCallback = std::function<void(int, const V2TIMString&)>;
ValueCallback() = default;
~ValueCallback() override = default;
void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {
success_callback_ = std::move(success_callback);
error_callback_ = std::move(error_callback);
}
void OnSuccess(const T& value) override {
if (success_callback_) {
success_callback_(value);
}
}
void OnError(int error_code, const V2TIMString& error_message) override {
if (error_callback_) {
error_callback_(error_code, error_message);
}
}

private:
SuccessCallback success_callback_;
ErrorCallback error_callback_;
};

V2TIMStringVector officialAccountIDList;

auto callback = new ValueCallback<V2TIMTopicInfoResultVector>{};
callback->SetCallback(
[=](const V2TIMOfficialAccountInfoResultVector& officialAccountInfoResultList) {
delete callback;
},
[=](int error_code, const V2TIMString& error_message) {
delete callback;
});

V2TIMManager::GetInstance()->GetFriendshipManager()->GetOfficialAccountsInfo(
officialAccountIDList, callback);

Official channel Messaging

Official channels support two types of messages:
1. ​Broadcast messages - Sent to all subscribers.
2. ​One-to-one messages - Private conversations between the official channel and individual subscribers.

Send Broadcast Messages

Use the ​server-side broadcast message API to send messages to all subscribers of an official channel.

Exchange One-to-One Messages

Subscriber → Official channel:
Use the IMSDK's sendMessage (Java / Swift / Objective-C /C++) with the official channel's officialAccountID as the receiver.
Official channel → Subscriber:
From_Account: Official channel's officialAccountID
To_Account: Subscriber's userID

Receive Messages

Both message types can be received via the IMSDK's ​message listener.


ヘルプとサポート

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

フィードバック