Browse SDKs · WASM
SDKsWASM

Update friend information

Update friend remarks, pinning state, or extension data.

Copy

updateFriends() applies the same set of fields to every friend in friendUserIDs.

Parameters

ParameterTypeRequiredDescription
friendUserIDsstring[]YesUser IDs of the friends to update.
remarkstringNoNew remark.
isPinnedbooleanNoWhether to pin the friends.
exstringNoNew extension string. It completely replaces the previous value.

In addition to friendUserIDs, pass at least one field that actually needs to be updated.

await openimsdk.updateFriends({
  friendUserIDs: [friendUserID],
  remark: remark.trim(),
  isPinned: true,
});

Call the method separately when different friends need different values. ex is a complete string and does not merge JSON fields automatically.

A successful Promise means that the update request has completed. Merge the final profiles from OnFriendInfoChanged by userID. See Get the friend list for the complete listener.