Group
core class.chat.getGroupProfile(options);
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 Custom Group Field. |
Promise
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});
inviteOption
.inviteOption
.chat.updateGroupProfile(options);
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, up to 100 bytes, using UTF-8 encoding. |
avatar | String | undefined | Group avatar URL, up to 500 bytes. |
introduction | String | undefined | Group introduction, up to 400 bytes, using UTF-8 encoding. |
notification | String | undefined | Group notice, up to 400 bytes, using UTF-8 encoding. |
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 TencentCloudChat.TYPES.GRP_WORK , TencentCloudChat.TYPES.GRP_MEETING , and TencentCloudChat.TYPES.GRP_AVCHATROOM groups. Work groups cannot be joined on request, and meeting groups and AVChatRoom can be joined freely.Note: |
inviteOption | String | Group inviting option. Valid values: TencentCloudChat.TYPES.INVITE_OPTIONS_FREE_ACCESS : allow free group invitingTencentCloudChat.TYPES.INVITE_OPTIONS_NEED_PERMISSION : require approval for group invitingTencentCloudChat.TYPES.INVITE_OPTIONS_DISABLE_INVITE : forbid group invitingNote: For groups of type TencentCloudChat.TYPES.GRP_AVCHATROOM , this attribute is not allowed to be modified, while all other types of groups support modification. |
groupCustomField | Array | undefined | Custom group field, which is unavailable by default. For more information on how to enable a custom group field, see Custom Group Field. |
Promise
let promise = chat.updateGroupProfile({groupID: 'group1',name: 'new name', // Modify the group nameintroduction: 'this is introduction.', // Modify the group introductiongroupCustomField: [{ 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 memberslet 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) // modify the group details success}).catch(function(imError) {console.warn('updateGroupProfile error:', imError); // modify the group details error});
Was this page helpful?