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

Get your profile

Query the account-level profile and message reception settings of the authenticated user.

Copy

Invoke getSelfUserInfo() to retrieve the account profile of the currently authenticated user. This method accepts no parameters.

Code example

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

const currentUser = await getSelfUserInfo()
if (currentUser != null) {
  setCurrentUser(currentUser)
}

Return value

The Promise resolves with an OpenIMUserInfo | null object:

PropertyTypeDescription
userIDstringThe authenticated user's OpenIM user ID.
nicknamestringAccount-level display nickname.
faceURLstringAccount-level avatar URL.
exstringCustom extension string agreed upon by application conventions.
createTimenumber | nullAccount creation timestamp in Unix milliseconds.
attachedInfostring | nullAdditional internal SDK metadata.
globalRecvMsgOptOpenIMMessageReceiveOption | nullAccount-level message reception option. See Set global message reception for valid values.
addFriendPermission CommercialOpenIMAddFriendPermission | nullFriend request handling policy. See Set friend request permissions for valid values.

Always compare options against exported SDK constants rather than checking raw numeric literals.

State changes after the call

This is a read-only query that retrieves a local snapshot without modifying data or triggering events. When profile updates occur across sessions or devices, the SDK emits onSelfInfoUpdated. For event registration and unregistration patterns, see Update your profile. When switching user accounts, clear the active user profile from your application store before retrieving data for the new account.