User profiles
Manage user profile data through the Chat SDK. User profiles include name, avatar, and custom fields.
Get the current user's profile
TypeScript
import { NCEngine } from '@nexconn/chat';
const { code, data } = await NCEngine.userModule.getMyUserProfile();
if (code === 0) {
console.log('User profile:', data);
}
Update the current user's profile
TypeScript
const { code } = await NCEngine.userModule.updateMyUserProfile({
name: 'John Doe',
portraitUri: 'https://example.com/avatar.png',
extProfile: {
bio: 'Hello, world!',
},
});
if (code === 0) {
console.log('Profile updated');
}
Get another user's profile
TypeScript
const { code, data } = await NCEngine.userModule.getUserProfiles(['<user-id>']);
if (code === 0) {
console.log('User profile:', data?.[0]);
}
Profile fields
| Field | Type | Description |
|---|---|---|
userId | string | User ID |
name | string | Display name |
portraitUri | string | Avatar URL |
extProfile | Record<string, string> | Custom key-value data |
info
- Profile data is stored on the server and synced across devices.