Browse SDKs · WASM
SDKsWASM

Search friends

Search the current user’s friends.

Copy

Use one non-empty keyword. Trim whitespace before submitting the search.

Parameters

ParameterTypeRequiredDescription
keywordListstring[]YesSearch keywords. Currently, only the first non-empty keyword is used.
isSearchUserIDbooleanYesWhether to match user IDs.
isSearchNicknamebooleanYesWhether to match friend nicknames.
isSearchRemarkbooleanYesWhether 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.