chat.searchCloudGroupMembers(options);
Name | Type | Description |
keywordList | Array | required Keyword list, support up to 5 keywords. |
keywordListMatchType | String | undefined | Keyword List Matching Type: or: relational search ("or" relationship) (default) and: relational search ("and" relationship) |
groupTypeList | Array | undefined | If not provided, it defaults to searching all types of group members (live broadcast groups TencentCloudChat.TYPES.GRP_AVCHATROOM are not supported for search).Group Types Indicate: TencentCloudChat.TYPES.GRP_WORK friends work groupTencentCloudChat.TYPES.GRP_PUBLIC stranger social groupTencentCloudChat.TYPES.GRP_MEETING temporary meeting groupTencentCloudChat.TYPES.GRP_COMMUNITY community |
groupIDList | Array | undefined | Search specified group ID list, if not provided, it defaults to searching all groups. |
cursor | String | undefined | Starting position for each cloud group member search. Do not provide cursor for the first search, and use the value of cursor returned by the previous call to the searchCloudGroupMembers API for continuing the search. |
count | Number | undefined | Number of results for each cloud group member search, default is 20, maximum is 100. |
Promise
Name | Type | Description |
totalCount | Number | Total number of group members that meet the search criteria. |
searchResultList | Array | The list of group members that meet the search criteria, returned grouped by groupID . |
cursor | String | The cursor needed for calling the search API to continue pulling. |
searchResultList
is a list that contains the search result objects. The parameters are as described below:Name | Type | Description |
groupInfo | Object | Group information, including the following group details: groupID Group ID.name Group name.type Group type.avatar Group avatar. |
memberList | Array | List of group members meeting search criteria in the current group. Each group member in the list includes the following information: userID Group member user ID.nick Group member user nickname.nameCard Group name card. |
// Search specified keyword list and group ID list// - Search for group members in the current joined groups that contain 'test' or 'user', and the group ID is 'group1' or 'group2'let promise = chat.searchCloudGroupMembers({keywordList: ['test', 'user'],groupIDList: ['group1', 'group2'],});promise.then(function(imResponse) {// Search group members successfullyconst { totalCount, cursor, searchResultList } = imResponse.data;console.log(totalCount); // Total number of group members meeting search criteriaconsole.log(cursor); // Starting position for the next cloud search, if not present, indicates search results are fully retrievedconsole.log(searchResultList); // List of group members meeting search criteria, returned paginated grouping results, maximum return per page is 100, based on the input countfor (let i = 0; i < searchResultList.length; i++) {const searchResultItem = searchResultList[i];const { groupInfo, memberList } = searchResultItem;const { groupID, name, type, avatar } = groupInfo;// Group ID / Group name / Group type / Group avatarconsole.log(groupID, name, type, avatar);console.log(memberList); // List of members meeting criteria in the groupfor (let i = 0; i < memberList.length; i++) {const memberItem = memberList[i];const { userID, nick, nameCard } = memberItem;console.log(userID); // Group member user IDconsole.log(nick); // Group member user nicknameconsole.log(nameCard); // Group name card}}}).catch(function(imError) {console.error(imError); // search group members failed});
Was this page helpful?