• UIKit
  • SDK
  • 서버 API
Chat/
SDK/
React Native/
그룹/
SDK
  • Run Demo
  • SDK 통합
  • 초기화
  • 로그인 및 로그아웃
  • 메시지
    • 메시지 개요
    • 메시지 보내기
    • 메시지 받기
    • 과거 메시지
    • 메시지 전달
    • 메시지 수정
    • 메시지 삽입
    • 메시지 삭제
    • 메시지 비우기
    • 메시지 철회
    • 온라인 메시지
    • 읽음 확인
    • 메시지 조회
    • 그룹 @ 메시지
    • 지향적 그룹 메시지
    • 알림 음소거
    • 메시지 확장
  • 그룹
    • 개요
    • 그룹 관리
    • 그룹 정보
    • 그룹 멤버 관리
    • 그룹 멤버 정보
    • 그룹 속성 사용자 정의
    • 커뮤니티 관리
  • 사용자
    • 사용자 정보
    • 친구 관리
    • 친구 목록
    • 블록리스트
  • 오프라인 푸시
    • 오프라인 푸시
  • 국부 검색
    • 메시지 검색
    • 친구 검색
    • 그룹 검색
    • 그룹 멤버 검색
  • 시그널링
    • 시그널링 관리
  • Changelog
  • Guideline for Beginners
  • 콘솔 안내
    • 애플리케이션 생성 및 업그레이드
    • 기본 구성
    • 기능 구성
    • 계정 관리
    • 그룹 관리
    • 콜백 구성
  • 제품 소개
    • 메시지 관리
      • 1대1 메시지
      • 메시지 저장
      • 오프라인 푸시
      • 그룹 메시지
      • 메시지 포맷
    • 계정 시스템
      • 로그인 인증
      • 온라인 상태 관리
    • 그룹 관련
      • 그룹 시스템
      • 그룹 관리
    • 사용자 정보 및 관계망
      • 정보 관리
      • 관계망 관리
  • 구매 가이드
    • 과금 개요
    • 가격
  • 에러코드
이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

커뮤니티 관리

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.