Get your profile
Query the account-level profile and message reception settings of the authenticated user.
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:
| Property | Type | Description |
|---|---|---|
userID | string | The authenticated user's OpenIM user ID. |
nickname | string | Account-level display nickname. |
faceURL | string | Account-level avatar URL. |
ex | string | Custom extension string agreed upon by application conventions. |
createTime | number | null | Account creation timestamp in Unix milliseconds. |
attachedInfo | string | null | Additional internal SDK metadata. |
globalRecvMsgOpt | OpenIMMessageReceiveOption | null | Account-level message reception option. See Set global message reception for valid values. |
addFriendPermission Commercial | OpenIMAddFriendPermission | null | Friend 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.
Was this page helpful?