Browse SDKs · React Native
SDKsReact Native

Get user profiles

Get public user profiles with the OpenIM React Native SDK.

Copy

Call getUsersInfo() to retrieve public user information for a batch of user IDs. This is useful for friend candidates and stranger profile cards.

If your product needs to search by nickname, phone number, organization, email, or another business field, have your backend perform the search and authorization checks first, then pass the returned user IDs to getUsersInfo().

const userIDList = Array.from(new Set(['user_a', 'user_b']));
const users = await OpenIMSDK.getUsersInfo(userIDList);

Parameter description

userIDList is the array of user IDs to retrieve. Deduplicate the IDs before calling the API and keep the number of IDs in a single request within a reasonable limit.

Return result

The method returns the matching PublicUserItem[]:

FieldTypeDescription
userIDstringOpenIM user ID.
nicknamestringPublic account nickname.
faceURLstringPublic account avatar URL.
exstringAccount extension field whose format is defined by your business.

The returned array is not guaranteed to follow the order of the input IDs.

To retrieve the signed-in user's information, see Get your profile and Update your profile.