Browse SDKs · WASM
SDKsWASM

Get your profile

Get the profile of the currently signed-in user.

Copy
const { data: currentUser } = await openimsdk.getSelfUserInfo();

Return result

After the Promise succeeds, data contains the current account's SelfUserInfo:

FieldTypeDescription
userIDstringThe signed-in user's OpenIMSDK user ID. Use it to confirm which account the profile belongs to.
nicknamestringAccount-level nickname.
faceURLstringAccount-level avatar URL.
createTimenumberTime when the user record was created, as a Unix timestamp in milliseconds.
globalRecvMsgOptMessageReceiveOptionThe account's global message reception setting. See Set global message reception for the enum values.
addFriendPermission EnterpriseAddFriendPermissionPolicy applied when another user tries to add this account. See Set friend request permissions for its enum values.
attachedInfo Enterprisestring (optional)SDK attachment data. Parse it only according to a confirmed application contract.
exstringAccount-level extension string defined by the application.

This query returns the current user's profile at the time of the call and does not trigger a profile event. Clear the previous account's profile when switching accounts. See Update your profile to learn how to receive profile updates and query again when needed.