Real-time Information Broadcast | Brand Promotion | Providing Convenient Services | Local Guides |
Official Accounts provide a trusted platform for broadcasting information, enabling organizations to quickly share news, updates, and knowledge with a broad audience using rich media formats. | Businesses leverage Official Accounts to deliver brand stories, product announcements, and targeted content directly to users, strengthening brand recognition and influence. | Official Accounts support high-frequency service features, such as online transactions (including transfers and appointment bookings) and information lookups (such as logistics tracking and grade inquiries), offering convenient self-service capabilities for subscribers. | Official Accounts serve as practical guides for local communities by aggregating relevant information—such as locations of community vaccination sites—through rich media, enhancing day-to-day convenience for subscribers. |
![]() | ![]() | ![]() | ![]() |





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 |
subscribeOfficialAccount method (Java / Swift / Objective-C / C++) and pass the officialAccountID as the parameter.onOfficialAccountSubscribed callback notification (Java / Swift / Objective-C / C++) .onOfficialAccountInfoChanged callback notification (Java / Swift / Objective-C / C++) .onOfficialAccountDeleted callback notification (Java / Swift / Objective-C / C++).V2TIMManager.getFriendshipManager().subscribeOfficialAccount("official_test", new V2TIMCallback() {@Overridepublic void onSuccess() {}@Overridepublic void onError(int code, String desc) {}});V2TIMManager.getFriendshipManager().addFriendListener(new V2TIMFriendshipListener() {@Overridepublic void onOfficialAccountSubscribed(V2TIMOfficialAccountInfo officialAccountInfo) {}@Overridepublic void onOfficialAccountDeleted(String officialAccountID) {}@Overridepublic void onOfficialAccountInfoChanged(V2TIMOfficialAccountInfo officialAccountInfo) {}});
V2TIMManager.shared.subscribeOfficialAccount(officialAccountID: "officialAccountID") {print("subscribeOfficialAccount succ")} fail: { code, desc inprint("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, desc: %@", code, desc);}];[[V2TIMManager sharedInstance] addFriendListener:self];- (void)onOfficialAccountSubscribed:(V2TIMOfficialAccountInfo *)officialAccountInfo {}- (void)onOfficialAccountDeleted:(NSString *)officialAccountID {}- (void)onOfficialAccountInfoChanged:(V2TIMOfficialAccountInfo *)officialAccountInfo {}desc
class Callback final : public V2TIMCallback {public:using SuccessCallback = std::function<void()>;using ErrorCallback = std::function<void(int, const V2TIMString&)>;Callback() = default;~Callback() override = default;void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {success_callback_ = std::move(success_callback);error_callback_ = std::move(error_callback);}void OnSuccess() override {if (success_callback_) {success_callback_();}}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);
unsubscribeOfficialAccount method (Java / Swift / Objective-C / C++) and pass the officialAccountID as the parameter.onOfficialAccountUnsubscribed callback notification(Java / Swift / Objective-C / C++).V2TIMManager.getFriendshipManager().unsubscribeOfficialAccount("official_test", new V2TIMCallback() {@Overridepublic void onSuccess() {}@Overridepublic void onError(int code, String desc) {}});V2TIMManager.getFriendshipManager().addFriendListener(new V2TIMFriendshipListener() {@Overridepublic void onOfficialAccountUnsubscribed(String officialAccountID) {}});
V2TIMManager.shared.unsubscribeOfficialAccount(officialAccountID: "officialAccountID") {print("unsubscribeOfficialAccount succ")} fail: { code, desc inprint("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, desc: %@", code, desc);}];[[V2TIMManager sharedInstance] addFriendListener:self];- (void)onOfficialAccountUnsubscribed:(V2TIMOfficialAccountInfo *)officialAccountInfo {}
class Callback final : public V2TIMCallback {public:using SuccessCallback = std::function<void()>;using ErrorCallback = std::function<void(int, const V2TIMString&)>;Callback() = default;~Callback() override = default;void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {success_callback_ = std::move(success_callback);error_callback_ = std::move(error_callback);}void OnSuccess() override {if (success_callback_) {success_callback_();}}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);
getOfficialAccountsInfo interface (Java / Swift / Objective-C / C++) to retrieve the official channel list.officialAccountIDList is empty, it returns the list of subscribed official channels.officialAccountIDList, it returns information for those specified official channels.List<String> officialAccountIDList = new ArrayList<>();V2TIMManager.getFriendshipManager().getOfficialAccountsInfo(officialAccountIDList, new V2TIMValueCallback<List<V2TIMOfficialAccountInfoResult>>() {@Overridepublic void onSuccess(List<V2TIMOfficialAccountInfoResult> v2TIMOfficialAccountInfoResults) {}@Overridepublic void onError(int code, String desc) {}});
V2TIMManager.shared.getOfficialAccountsInfo(officialAccountIDList: ["officialAccountID"]) { officialAccountResultList inofficialAccountResultList.forEach { item inprint(item.description)}} fail: { code, desc inprint("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_;};auto callback = new ValueCallback<V2TIMOfficialAccountInfoResultVector>{};callback->SetCallback([=](const V2TIMOfficialAccountInfoResultVector& officialAccountInfoResultList) {delete callback;},[=](int error_code, const V2TIMString& error_message) {delete callback;});V2TIMManager::GetInstance()->GetFriendshipManager()->GetOfficialAccountsInfo(officialAccountIDList, callback);

sendMessage (Java / Swift / Objective-C /C++) with the official channel's officialAccountID as the receiver.officialAccountID.userID.





addConversationsToGroup.
文档反馈