SDKsuni-app
Get your profile
Read the OpenIM profile of the logged-in user.
After initialization, login, and connection readiness, call getSelfUserInfo() to query the current account's profile:
import {
getSelfUserInfo,
type OpenIMUserInfo,
} from '@/uni_modules/unix-openim-sdk'
const currentUser : OpenIMUserInfo | null = await getSelfUserInfo()
if (currentUser != null) {
renderProfile(currentUser.nickname, currentUser.faceURL)
}Return result
The Promise resolves directly to OpenIMUserInfo or null, without a { data } wrapper. A non-null object contains:
| Field | Type | Description |
|---|---|---|
userID | string | Signed-in user's OpenIMSDK user ID and the stable identifier for this profile snapshot. |
nickname | string | Account-level nickname. |
faceURL | string | Account-level avatar URL. |
createTime | number or null (optional) | Time when the user record was created. |
globalRecvMsgOpt Enterprise | number or null (optional) | Account-level message reception option. See Set global message reception. |
attachedInfo Enterprise | string or null (optional) | SDK attachment data. Parse it only according to a confirmed application contract. |
ex | string | Account-level extension string defined by the application. |
Verify that the returned userID matches the current application account. Do not fabricate an empty user object when the result is null; use login state and redacted diagnostics to determine why a snapshot is unavailable.
This query establishes a snapshot and does not trigger a profile event. Clear it when switching accounts. See Update your profile for merging onSelfInfoUpdated and reconciling with another query.
Was this page helpful?