SDKsWASM
Search friends
Search the current user’s friends.
Use one non-empty keyword. Trim whitespace before submitting the search.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
keywordList | string[] | Yes | Search keywords. Currently, only the first non-empty keyword is used. |
isSearchUserID | boolean | Yes | Whether to match user IDs. |
isSearchNickname | boolean | Yes | Whether to match friend nicknames. |
isSearchRemark | boolean | Yes | Whether to match friend remarks. |
const { data: friends } = await openimsdk.searchFriends({
keywordList: [keyword.trim()],
isSearchUserID: true,
isSearchNickname: true,
isSearchRemark: true,
});After the Promise succeeds, read the SearchFriendsResultItem[] from data. Each item includes all FriendUserItem fields and an additional relationship value. See Get the friend list for friend profile fields.
Search results contain only the friends matched by the current query. Use userID to associate each result with existing friend data, and do not replace the complete friend list with the search results.
Was this page helpful?