tencent cloud

Feedback

JavaScript

Last updated: 2024-11-15 11:07:32

    Getting the Profile of Group Members

    Note:
    1. TencentCloudChat.TYPES.GRP_AVCHATROOM (AVChatRoom) does not support this operation, error code 2687.
    2. The maximum number of users in each query is 50. If the length of the array passed in is greater than 50, only the first 50 users will be queried, and the rest will be discarded.
    API
    chat.getGroupMemberProfile(options);
    Parameter
    The options parameter is of the Object type. It contains the following attribute values:
    Name
    Type
    Description
    groupID
    String
    Group ID
    userIDList
    Array
    List of IDs of the group members to be queried
    memberCustomFieldFilter
    Array | undefined
    Filtering the custom group member field. This attribute is optional. If it is not specified, all the custom group member fields are queried by default.
    Returned value
    Promise
    Sample
    let promise = chat.getGroupMemberProfile({
    groupID: 'group1',
    // Even if you retrieve the profile of only one group member, the value must be of array type
    // for example, userIDList: ['user1'].
    userIDList: ['user1', 'user2'],
    memberCustomFieldFilter: ['group_member_custom'],
    });
    promise.then(function(imResponse) {
    console.log(imResponse.data.memberList); // Group member list
    }).catch(function(imError){
    console.warn('getGroupMemberProfile error:', imError);
    });

    Setting the Name Card of a Group Member

    Note:
    1. TencentCloudChat.TYPES.GRP_AVCHATROOM (AVChatRoom) does not support this operation, error code 2687.
    2. Description of Operation Permissions:
    Group Owner: Can set the namecard for all group members.
    Administrator: Can set the namecard for themselves and other ordinary group members.
    Ordinary Group Member: Can only set their own group namecard.
    API
    chat.setGroupMemberNameCard(options);
    Parameter
    The options parameter is of the Object type. It contains the following attribute values:
    Name
    Type
    Description
    groupID
    String
    Group ID or topic ID
    userID
    String | undefined
    It is optional. By default, the user's own name card is modified.
    nameCard
    String
    Name card of a group member
    Returned value
    Promise
    Sample
    let promise = chat.setGroupMemberNameCard({
    groupID: 'group1',
    userID: 'user1',
    nameCard: 'Name card'
    });
    promise.then(function(imResponse) {
    console.log(imResponse.data.group); // New group profile
    console.log(imResponse.data.member); // New group member profile
    }).catch(function(imError){
    console.warn('setGroupMemberNameCard error:', imError);
    });

    Setting a Custom Group Member Field

    Note:
    1. TencentCloudChat.TYPES.GRP_AVCHATROOM (AVChatRoom) does not support this operation, error code 2687.
    2. Ordinary group members can only set their own custom fields.
    API
    chat.setGroupMemberCustomField(options);
    Parameter
    The options parameter is of the Object type. It contains the following attribute values:
    Name
    Type
    Description
    groupID
    String
    Group ID or topic ID
    userID
    String | undefined
    Optional. If it is not specified, the user's own custom group member field is modified.
    memberCustomField
    Array
    Custom group member field. Its array elements are as structured below:
    key --- String --- Key of the custom field
    value --- String --- Value of the custom field
    Returned value
    Promise
    Sample
    let promise = chat.setGroupMemberCustomField({
    groupID: 'group1',
    memberCustomField: [{key: 'group_member_test', value: 'test'}]
    });
    promise.then(function(imResponse) {
    console.log(imResponse.data.group); // New group profile
    console.log(imResponse.data.member); // New group member profile
    }).catch(function(imError){
    console.warn('setGroupMemberCustomField error:', imError);
    });

    Marking Group Members

    Note:
    1. Only supports AVChatRoom and only the group owner has the permission to mark other members in the group.
    2. Using this interface requires you to purchase the Premium edition.
    API
    chat.markGroupMemberList(options);
    Parameter
    The options parameter is of the Object type. It contains the following attribute values:
    Name
    Type
    Description
    groupID
    String
    Group ID or topic ID
    userIDList
    Array.<String>
    List of group member userIDs, with a maximum of 500 group members per request.
    markType
    Number
    Mark type. Greater than or equal to 1000, you can customize it. A maximum of 10 marks are allowed to be defined in an AVChatRoom.
    Returned value
    Promise
    Sample
    let promise = chat.markGroupMemberList({
    groupID: 'group1',
    userIDList: ['user1', 'user2'],
    markType: 1000,
    enableMark: true,
    });
    promise.then(function(imResponse) {
    const { successUserIDList, failureUserIDList } = imResponse.data;
    }).catch(function(imError) {
    console.warn('markGroupMemberList error:', imError);
    });
    // Get the list of online members with a specified mark in the AVChatRoom
    let promise = chat.getGroupMemberList({ groupID: 'group1', filter: 1000, offset: 0 });
    promise.then(function(imResponse) {
    console.log(imResponse.data.memberList); // Group member list
    }).catch(function(imError) {
    console.warn('getGroupMemberList error:', imError);
    });
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support