Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app x

Update friend information

Batch update friend remarks, pin states, or custom extension strings.

Copy

Invoke updateFriends() to update friendship metadata across one or more friend records. Changes specified in the parameters are applied uniformly to all users listed in friendUserIDs. To configure unique values for different friends, execute separate calls.

Parameters

ParameterTypeRequiredDescription
friendUserIDsstring[]YesAn array of friend user IDs to update.
remarkstringNoNew custom friend remark or alias.
isPinnedbooleanNoWhether to pin this friend in the contact list.
exstringNoNew custom relationship extension string; completely overwrites existing data.

Supply at least one modification field in addition to friendUserIDs.

Code example

import { updateFriends } from '@/uni_modules/unix-openim-sdk'

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

Return value

The Promise resolves with void once OpenIMServer accepts the friendship modification request.

State changes after the call

A resolved Promise confirms that the request completed successfully. It does not mean the onFriendInfoChanged event has arrived at all listening clients. When the event arrives, clients merge the updated record into their store by userID. To calibrate immediately, re-query the friend record using Get friend profiles. The ex property is an opaque string and is not merged automatically by the SDK.