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

그룹 멤버 관리

Description

Group member management includes pulling the member list, muting group members, removing group members, granting permissions, and transferring the group ownership.

Getting the Group Member List

Caution
1. This API supports pulling the muting stop timestamp (muteUntil) of group members. Based on this value, you can determine if a member is muted and the remaining muting time.
2. This API retrieves group members in pages and cannot be used directly to get the total number of group members. To get the total number of group members (memberCount), please use getGroupProfile.
3. When the API returns an offset of 0, it means all group members have been retrieved.
4. The following special restrictions are added for audio-video groups (AVChatRoom):
The Enterprise Edition supports pulling up to 1,000 recently joined group members, with new members ranked first. To use this feature, you need to purchase the Enterprise Edition package and enable the feature in the Chat Console.
When the Enterprise Edition uses this API, the SDK will ignore the count parameter, and a single query will return up to 500 group members by default.
On the Ultimate edition, this API can be called up to one time per three seconds. To query the group member list periodically, you are advised to call the API once every ten seconds.
The group member profile information only supports the fields userID, nick, avatar, and joinTime. To set nick and avatar information, please call: updateMyProfile.
5. The Enterprise Edition supports fetching the list of designated tagged group members in live groups (AVChatRoom) based on the filter parameter. Please refer to: markGroupMemberList to tag group members.
To enable the feature of online group member lists in live groups for the Advanced Edition, please log in to the Chat Console and modify the relevant configuration. The configuration page is shown below:



API
chat.getGroupMemberList(options);
Parameters
The options parameter is of the Object type, and contains the following attribute values:
Name
Type
Description
groupID
String
Group ID
count
Number
The number of entries to be fetched. Default value: 15, Maximum value: 100, to avoid response failure due to large packages. If more than 100 is passed in, only the first 100 will be fetched (the Enterprise Edition for live groups ignores the count parameter when using this API).
offset
Number
Offset, default is to start pulling from 0.
Return values
Promise
Example
let promise = chat.getGroupMemberList({
groupID: 'group1',
count: 30,
offset:0,
}); // Pull 30 group members starting from 0
promise.then(function(imResponse) {
console.log(imResponse.data.memberList); // Group member list
}).catch(function(imError) {
console.warn('getGroupMemberList error:', imError);
});
// This API supports pulling the muting end timestamp of group members.
let promise = tim.getGroupMemberList({
groupID: 'group1',
count: 30,
offset:0,
}); // Pull 30 group members starting from 0
promise.then(function(imResponse) {
console.log(imResponse.data.memberList); // Group member list
for (let groupMember of imResponse.data.memberList) {
if (groupMember.muteUntil * 1000 > Date.now()) {
console.log(`${groupMember.userID} muted`);
} else {
console.log(`${groupMember.userID} not muted`);
}
}
}).catch(function(imError) {
console.warn('getGroupMemberProfile error:', imError);
});
// The Enterprise Edition Package supports retrieving the list of online members in the live group
let promise = chat.getGroupMemberList({
groupID: 'group1',
offset:0, // Default is to start pulling from 0
});
promise.then(function(imResponse) {
console.log(imResponse.data.memberList); // Group member list
}).catch(function(imError) {
console.warn('getGroupMemberList error:', imError);
});

Mute

Mute specific group members

Caution
1. TencentCloudChat.TYPES.GRP_WORK type groups (i.e., friend work groups) do not support this operation.
2. TencentCloudChat.TYPES.GRP_AVCHATROOM type groups (i.e., live chat groups) do not support this operation.
3. To ban or kick out group members in live chat groups, you need to purchase the Enterprise Edition Package and use the deleteGroupMember interface.
4. If you need to mute all members, please refer to updateGroupProfile.
5. It supports setting a mute duration for community members within topics by passing topicID as groupID.
6. Only the group owner and administrators have this permission:
The group owner can mute/unmute administrators and ordinary group members.
Administrators can mute/unmute ordinary group members.
API
chat.setGroupMemberMuteTime(options);
Parameters
The options parameter is of the Object type, and contains the following attribute values:
Name
Type
Description
groupID
String
Group ID or topic ID
userID
String
User ID
muteTime
Number
Mute duration, in seconds. For example, setting it to 1000 means muting the user for 1000 seconds from now; setting it to 0 means unmuting.
Return values
Promise
Example
let promise = chat.setGroupMemberMuteTime({
groupID: 'group1',
userID: 'user1',
muteTime: 600 // Mute for 10 minutes; set to 0 to unmute
});
promise.then(function(imResponse) {
console.log(imResponse.data.group); // New group profile
console.log(imResponse.data.group); // New group profile
}).catch(function(imError) {
console.warn('setGroupMemberMuteTime error:', imError); // Error information
});
// Set the period for muting a group member in the topic
let promise = chat.setGroupMemberMuteTime({
groupID: 'topicID',
userID: 'user1',
muteTime: 600 // Mute for 10 minutes; set to 0 to unmute
});
promise.then(function(imResponse) {
console.log(imResponse.data.group); // New group profile
console.log(imResponse.data.group); // New group profile
}).catch(function(imError) {
console.warn('setGroupMemberMuteTime error:', imError); // Error information
});

Mute the entire group

// Global Mute
let promise = chat.updateGroupProfile({
groupID: 'group1',
muteAllMembers: true, // `true`: mute all; `false`: unmute all
});
promise.then(function(imResponse) {
console.log(imResponse.data.group) // Detailed group profile after modification
}).catch(function(imError) {
console.warn('updateGroupProfile error:', imError); // Error information
});

Kick out

Caution
1. The flagship package supports removing live group members. You can achieve the effect of [Ban Group Members] in live chat groups by calling this interface.
2. The kick out duration field is supported only by live chat groups (AVChatRoom).
3. After a group member is removed from a live chat group, within the kick out duration, if the user wants to rejoin the group, the app admin needs to call the REST API to unban them. After the kick out duration, the user can proactively join the live chat group again.
API
chat.deleteGroupMember(options);
Parameters
The options parameter is of the Object type, and contains the following attribute values:
Name
Type
Description
groupID
String
Group ID or topic ID
userIDList
Array
List of IDs of the group members to be removed
reason
String | undefined
Reason for kicking out
duration
Number
Kick-out duration must be greater than 0 (supported only by live broadcast groups)
Return values
Promise
Example
// Removing group members from non-live broadcast groups
let promise = chat.deleteGroupMember({
groupID: 'group1',
userIDList:['user1'],
reason: 'You violated the rules, I'm kicking you out!',
});
promise.then(function(imResponse) {
console.log(imResponse.data.group); // Group profile after group member removal
console.log(imResponse.data.userIDList); // List of userID of the removed group member
}).catch(function(imError) {
console.warn('deleteGroupMember error:', imError); // Error information
});
// Removing group members from live broadcast groups
let promise = chat.deleteGroupMember({
groupID: 'group1',
userIDList:['user1'],
reason: 'You violated the rules, I'm kicking you out!',
duration: 60,
});
promise.then(function(imResponse) {
console.log(imResponse.data.group); // Group profile after group member removal
console.log(imResponse.data.userIDList); // List of userID of the removed group member
}).catch(function(imError) {
console.warn('deleteGroupMember error:', imError); // Error information
});

Changing the Role of a Group Member

Caution
1. TencentCloudChat.TYPES.GRP_WORK type groups (i.e., friend work groups) do not support this operation.
2. TencentCloudChat.TYPES.GRP_AVCHATROOM type groups (i.e., live chat groups) do not support this operation.
API
chat.setGroupMemberRole(options);
Parameters
The options parameter is of the Object type, and contains the following attribute values:
Name
Type
Description
groupID
String
Group ID or topic ID
userID
String
User ID
role
String
Valid values:
TencentCloudChat.TYPES.GRP_MBR_ROLE_ADMIN (Group Administrator),
TencentCloudChat.TYPES.GRP_MBR_ROLE_MEMBER (Group Regular Member),
TencentCloudChat.TYPES.GRP_MBR_ROLE_CUSTOM (Custom Group Member Roles, supported only by the Community)
Return values
Promise
Example
let promise = chat.setGroupMemberRole({
groupID: 'group1',
userID: 'user1',
role: TencentCloudChat.TYPES.GRP_MBR_ROLE_ADMIN // Set user: user1 as an admin in group ID: group1
});
promise.then(function(imResponse) {
console.log(imResponse.data.group); // New group profile
console.log(imResponse.data.group); // New group profile
}).catch(function(imError) {
console.warn('setGroupMemberRole error:', imError); // Error information
});

Getting Group Online Users

Caution
1. Currently, this API is supported only by audio-video groups (AVChatRoom).
2. When you are not in an audio-video group or use this API to query the number of users in a non-audio-video group, the SDK returns memberCount as 0. It is recommended to control the frequency of calling this interface to query the number of users in an audio-video group to once every 5-10 seconds.
API
chat.getGroupOnlineMemberCount(groupID);
Parameters
Name
Type
Description
groupID
String
Group ID
Return values
Promise
Example
// Querying the Number of Online Users in an Audio-Video Group
let promise = chat.getGroupOnlineMemberCount('group1');
promise.then(function(imResponse) {
console.log(imResponse.data.memberCount);
}).catch(function(imError) {
console.warn('getGroupOnlineMemberCount error:', imError); // Error information
});