• UIKit
  • SDK
  • サーバー API
Chat/
SDK/
React Native/
グループ/
SDK
  • Run Demo
  • SDK の統合
  • 初期化
  • ログインとログアウト
  • メッセージ
    • メッセージの概要
    • メッセージ送信
    • メッセージの受信
    • 過去のメッセージ
    • メッセージ転送
    • メッセージの変更
    • メッセージ挿入
    • メッセージ削除
    • メッセージをクリア
    • メッセージの取り消し
    • オンラインメッセージ
    • 既読レシート
    • クエリーメッセージ
    • グループ @ メッセージ
    • ターゲットグループメッセージ
    • 通知のサイレントモード
    • メッセージ拡張
  • グループ
    • Overview
    • グループ管理
    • グループプロファイル
    • グループメンバーの管理
    • グループメンバープロファイル
    • グループプロパティのカスタマイズ
    • コミュニティ管理
  • ユーザー
    • ユーザープロファイル
    • 友達管理
    • 友達リスト
    • ブラックリスト
  • オフラインプッシュ
    • オフラインプッシュ
  • ローカル検索
    • メッセージ検索
    • 友達を検索
    • グループの検索
    • グループメンバーの検索
  • シグナリング
    • シグナリング管理
  • Changelog
  • Guideline for Beginners
  • コンソールガイド
    • アプリケーションの作成とアップグレード
    • 基本設定
    • 機能設定
    • アカウント管理
    • グループ管理
    • コールバック設定
  • 製品紹介
    • メッセージ管理
      • シングルチャットメッセージ
      • メッセージの保存
      • オフラインプッシュ
      • グループメッセージ
      • メッセージフォーマット
    • アカウントシステム
      • ログイン認証
      • オンライン状態管理
    • グループ関連
      • グループシステム
      • グループ管理
    • ユーザープロファイルとリレーションシップチェーン
      • 資料管理
      • リレーションシップチェーン管理
  • 購入ガイド
    • 課金の概要
    • 価格
  • エラーコード
このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

コミュニティ管理

Feature Description

A community group is a large group of people brought together by common topics, and multiple topics can be created under the same community group based on different interests. Community groups are used to manage group members. All topics under the same community group are shared among members, who can send and receive messages within each topic independently.
Community and topic management APIs are in the TencentImSDKPlugin.v2TIMManager.getGroupManager() core class.
The topic message APIs are in the TencentImSDKPlugin.v2TIMManager.getMessageManager() core class.
Note:
To use the feature, you need to purchase the Ultimate edition, go to the console, choose Feature Configuration > Group configuration > Group feature configuration > Community, and enable the community feature.

Community Group Management

Creating a community group

You need to perform two steps to create a community group that supports topics:
1. Create the V2TIMGroupInfo object (Details) and set groupType to Community and isSupportTopic to true/YES.
2. Call the createGroup API (Details) to create a community.
Sample code:
// Create a topic-enabled community
groupManager.createGroup(groupType: "Community", groupName: "Community",isSupportTopic: true);

Getting the list of community groups joined

Call getJoinedCommunityList (Details) to get the list of joined topic-enabled communities.
Sample code:
// Getting the list of community groups joined
const groupList = await groupManager.getJoinedCommunityList();

Other management APIs

Other features can be used in the same way as an ordinary group feature and involve the following APIs:
Category
Feature
API
Community group management
joinGroup (TS)
quitGroup (TS)
dismissGroup (TS)
getGroupsInfo (TS)
setGroupInfo (TS)
Community group member management
getGroupMemberList (TS)
getGroupMembersInfo (TS)
setGroupMemberInfo (TS)
kickGroupMember (TS)


Topic Management

Multiple topics can be created under the same community group. All the topics are shared among group members, who can send and receive messages within each topic independently.
Note:
To use the feature, you need to go to the console, choose Feature Configuration > Group configuration > Group feature configuration > Community, enable the community feature and then enable the topic feature.

Creating a topic

You need to perform two steps to create a topic:
1. Create the V2TIMTopicInfo (Details) object.
2. Call the createTopicInCommunity API (Details) to create a topic.
Sample code:
// Create a topic
groupManager.createTopicInCommunity("groupID", {
topicName: "topic",
});

Deleting a topic

Call the deleteTopicFromCommunity API (Details) to delete a topic.
Sample code:
// Delete a topic
groupManager.deleteTopicFromCommunity("groupID", ["topicID"]);

Modifying topic information

You need to perform two steps to modify the information of a topic:
1. Create the V2TIMTopicInfo object (Details) and set the fields to be modified.
2. Call the setTopicInfo API (Details) to modify the information of a topic.
Sample code:
// Modify topic information
groupManager.setTopicInfo({
topicName: "topicName",
});

Getting the topic list

Call the getTopicInfoList API (Details) to get the topic list.
If topicIDList is empty, the list of all topics of the community group will be got.
If topicIDList is the ID of specified topics, the list of the specified topics will be got.
Sample code:
// Get the topic list
groupManager.getTopicInfoList("groupID", ["topicID"]);

Topic groups

The community is a new powerful tool for entertainment collaboration and supports the community-group-topic hierarchy to isolate messages.

The customInfo of a community saves the topic group list of the community, while the customString field of each topic stores the topic group.
When a community is loaded, the customInfo field for the topic group list of the community (group) is used to display the group list. We recommend you store the field in the string[] format.
To get the topics in each group, traverse the topic list and get the group of each topic through the customString of V2TimTopicInfo.
Note:
You can customize the key value of the customInfo field for the topic group list of the community (group). The following sample code names it categoryList.

Getting the list of groups in the community

Call the getCommunityCategoryList(String groupID) method. Sample code:
const getCommunityCategoryList = async (groupID) => {
const customInfo = await getCommunityCustomInfo(groupID);
if (customInfo != null) {
const categoryListString = customInfo["categoryList"];
if (categoryListString != null && categoryListString !== "") {
return JSON.parse(categoryListString);
}
}
};

const getCommunityCustomInfo = async (groupID) => {
const groupIDList = [groupID];
const res = await TencentImSDKPlugin.v2TIMManager
.getGroupManager()
.getGroupsInfo(groupIDList);
if (res.code != 0) {
const groupInfo = res.data[0];
if (groupInfo != null) {
const customInfo = groupInfo.groupInfo?.customInfo;
return customInfo;
}
}
return null;
};

Configuring the group list for the community

You just need to modify the customInfo in groupInfo. Here is a Map, and the key value is the name of the field for the topic group list you defined.
The getCommunityCustomInfo method is implemented in the above section. Sample code:
const setCommunityCategoryList = async (
groupID,
groupType,
newCategoryList
) => {
const customInfo = await getCommunityCustomInfo(groupID);
customInfo["categoryList"] = JSON.parse(newCategoryList);
TencentImSDKPlugin.v2TIMManager.getGroupManager().setGroupInfo({
customInfo: customInfo,
groupID: groupID,
groupType: groupType,
// ...Other profiles
});
};

Adding a topic to a group

Sample code:
const addCategoryForTopic = (groupID, categoryName) => {
TencentImSDKPlugin.v2TIMManager.getGroupManager().setTopicInfo({
customString: categoryName,
});
};

Getting the topic group

Use the customString after getting the topic list.

Listening for topic callbacks

In V2TIMGroupListener (Details), topic callback methods such as onTopicCreated, onTopicDeleted, and onTopicInfoChanged are added to listen for topic events.
Sample code:
const v2TIMGroupListener = {
onTopicCreated: (groupID, topicID) => {
// Listen for topic creation notifications
},
onTopicDeleted: (groupID, topicIDList) => {
// Listen for topic deletion notifications
},
onTopicInfoChanged: (groupID, topicInfo) => {
// Listen for topic information update notifications
},
};
V2TIMManager.getInstance().addGroupListener(v2TIMGroupListener);

Topic Messages

Topic messages can be used in the same way as ordinary messages and involve the following APIs:
Feature
API
Description
Sends a message
sendMessage (TS)
Set `groupID` to the topic ID.
Receives a message
`onRecvNewMessage` method in `V2TIMAdvancedMsgListener` (TS)
Set `groupID` in the message to the topic ID.
Marks a message as read
markGroupMessageAsRead (TS
Set `groupID` to the topic ID.
Gets historical messages
getGroupHistoryMessageList (TS
Set `groupID` to the topic ID.
Recalls a message
revokeMessage (TS)
Set `groupID` to the topic ID.