このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

グループプロファイル

Feature Description

The group profile refers to the information about the group, the attributes of which are in the Group core class.

Getting the Group Profile

API
chat.getGroupProfile(options);
Parameter
The options parameter is of the Object type. It contains the following attribute values:
Name
Type
Description
groupID
String
Group ID
groupCustomFieldFilter
Array | undefined
Custom group field filter. You can specify the custom group field to be obtained. For more information, see Group System.
Returned value
Promise
Sample
let promise = chat.getGroupProfile({ groupID: 'group1', groupCustomFieldFilter: ['key1','key2'] });
promise.then(function(imResponse) {
console.log(imResponse.data.group);
}).catch(function(imError){
console.warn('getGroupProfile error:', imError); // Failed to obtain the detailed group profile
});

Modifying the Group Profile

API
chat.updateGroupProfile(options);
Parameter
The options parameter is of the Object type. It contains the following attribute values:
Name
Type
Description
groupID
String
Group ID
name
String | undefined
Group name, which can contain up to 30 bytes.
avatar
String | undefined
Group profile photo URL, which can contain up to 100 bytes.
introduction
String | undefined
Group introduction, which can contain up to 240 bytes.
notification
String | undefined
Group notice, which can contain up to 300 bytes.
maxMemberNum
Number | undefined
Maximum number of group members, which is 6,000.
muteAllMembers
Boolean | undefined
Muting all. Valid values:
true: mute all;
false: unmute all.
joinOption
String
Method to join a group. Valid values:
TencentCloudChat.TYPES.JOIN_OPTIONS_FREE_ACCESS (free to join)
TencentCloudChat.TYPES.JOIN_OPTIONS_NEED_PERMISSION (approval required)
TencentCloudChat.TYPES.JOIN_OPTIONS_DISABLE_APPLY (no group join)
Note: It cannot be modified for TIM.TYPES.GRP_WORK, TIM.TYPES.GRP_MEETING, and TIM.TYPES.GRP_AVCHATROOM groups. Work groups cannot be joined on request, and meeting groups and audio-video groups can be joined freely.
inviteOption
String
Group inviting option. Valid values:
TencentCloudChat.TYPES.INVITE_OPTIONS_FREE_ACCESS: allow free group inviting
TencentCloudChat.TYPES.INVITE_OPTIONS_NEED_PERMISSION: require approval for group inviting
TencentCloudChat.TYPES.INVITE_OPTIONS_DISABLE_INVITE: forbid group inviting
groupCustomField
Array | undefined
Custom group field, which is unavailable by default. For more information on how to enable a custom group field, see Group System.
Returned value
Promise
Sample
let promise = chat.updateGroupProfile({
groupID: 'group1',
name: 'new name', // Modify the group name
introduction: 'this is introduction.', // Modify the group introduction
groupCustomField: [{ key: 'group_level', value: 'high'}] // Modify the group custom field
});
promise.then(function(imResponse) {
console.log(imResponse.data.group) // Detailed group profile after modification
}).catch(function(imError){
console.warn('updateGroupProfile error:', imError); // Failed to modify the group profile
});
// muting all group members
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); // Failed to modify the group profile
});
let promise = chat.updateGroupProfile({
groupID: 'group1',
inviteOption: TencentCloudChat.TYPES.INVITE_OPTIONS_NEED_PERMISSION,
});
promise.then(function(imResponse) {
console.log(imResponse.data.group) // 修改成功后的群组详细资料
}).catch(function(imError) {
console.warn('updateGroupProfile error:', imError); // 修改群组资料失败的相关信息
});