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 SearchedFriendsInfo[] from data. Each item includes all FriendUserItem fields and an additional relationship value. See Get the friend list for friend profile fields.
Search results are a display snapshot for the current criteria. Associate them with existing friend state by userID; do not replace the complete friend list.
Was this page helpful?