Update friend information
Batch update friend remarks, pin states, or custom extension strings.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
friendUserIDs | string[] | Yes | An array of friend user IDs to update. |
remark | string | No | New custom friend remark or alias. |
isPinned | boolean | No | Whether to pin this friend in the contact list. |
ex | string | No | New 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.
Was this page helpful?