User
    • Dark
      Light
    • PDF

    User

    • Dark
      Light
    • PDF

    Article summary

    The IUser interface represents the User object defining the properties and their types that can be associated with a user. User information is stored in the users collection on MongoDB.

    Main Interface

    The main interface of a User object.

    interface IUser {
    	_id: string;
    	createdAt: Date;
    	roles: IRole['_id'][];
    	type: string;
    	active: boolean;
    	username?: string;
    	nickname?: string;
    	name?: string;
    	services?: IUserServices;
    	emails?: IUserEmail[];
    	status?: UserStatus;
    	statusConnection?: string;
    	lastLogin?: Date;
    	bio?: string;
    	avatarOrigin?: string;
    	avatarETag?: string;
    	avatarUrl?: string;
    	utcOffset?: number;
    	language?: string;
    	statusDefault?: UserStatus;
    	statusText?: string;
    	oauth?: {
    		authorizedClients: string[];
    	};
    	_updatedAt: Date;
    	e2e?: {
    		private_key: string;
    		public_key: string;
    	};
    	requirePasswordChange?: boolean;
    	customFields?: {
    		[key: string]: any;
    	};
    	settings?: IUserSettings;
    	defaultRoom?: string;
    	ldap?: boolean;
    	extension?: string;
    	inviteToken?: string;
    	canViewAllInfo?: boolean;
    	phone?: string;
    	reason?: string;
    	federated?: boolean;
    	federation?: {
    		avatarUrl?: string;
    		searchedServerNames?: string[];
    	};
    	banners?: {
    		[key: string]: {
    			id: string;
    			priority: number;
    			title: string;
    			text: string;
    			textArguments?: string[];
    			modifiers: ('large' | 'danger')[];
    			link: string;
    			read?: boolean;
    		};
    	};
    	importIds?: string[];
    }

    For more information and details on the Interface and sub-Interfaces, see the code here

    User object

    Example object

    {
        "_id": "gzvcvpov9G4TxbGFS",
        "createdAt": {
            "$date": "2023-03-02T17:59:43.415Z"
        },
        "services": {
            "password": {
                "bcrypt": "$2b$10$u..."
            },
            "email2fa": {
                "enabled": true,
                "changedAt": {
                    "$date": "2023-03-02T17:59:43.415Z"
                }
            },
            "resume": {
                "loginTokens": []
            }
        },
        "username": "demouser",
        "emails": [
            {
                "address": "[email protected]",
                "verified": true
            }
        ],
        "type": "user",
        "status": "offline",
        "active": true,
        "_updatedAt": {
            "$date": "2023-03-02T18:47:15.205Z"
        },
        "__rooms": [
            "GENERAL"
        ],
        "roles": [
            "user"
        ],
        "name": "demouser",
        "requirePasswordChange": false,
        "settings": {},
        "lastLogin": {
            "$date": "2023-03-02T18:14:28.122Z"
        },
        "statusConnection": "offline",
        "e2e": {
            "private_key": "{\"$binary\":\"m4E7yE/...==\"}",
            "public_key": "{\"alg\":\"RSA-OAEP-256\",\"e\":\"AQAB\",\"ext\":true,\"key_ops\":[\"encrypt\"],\"kty\":\"RSA\",\"n\":\"0pbPAF67...w\"}"
        },
        "utcOffset": 1
    }

    Fields

    The User object has these fields with the following data types.

    Parameter

    Data type

    Description

    _id

    String

    The unique identifier for the user.

    createdAt

    Date

    The date and time when the user was created.

    roles

    Array of strings

    An array of role IDs associated with the user. E.g. "user", "admin", “livechat-agent”

    type

    String

    The type of user. E.g. “user”, “app” or “bot”

    active

    Boolean

    Indicates whether the user is active or not.

    username

    String

    The username of the user.

    nickname

    String

    The user’s nickname.

    name

    String

    The user’s name.

    services

    Object

    Additional services associated with the user.

    emails

    Array of objects

    An array of email objects associated with the user.

    status

    String

    The user’s status.

    statusConnection

    String

    The status connection of the user.

    lastLogin

    Date

    The date and time of the user's last login.

    bio

    String

    The user’s biography or description.

    avatarOrigin

    String

    The origin of the user's avatar.

    avatarETag

    String

    The ETag of the user's avatar.

    avatarUrl

    String

    The URL of the user's avatar.

    utcOffset

    Number

    The UTC offset of the user's timezone.

    language

    String

    The user’s language preference.

    statusDefault

    String

    The default status of the user.

    statusText

    String

    The custom status text of the user.

    oauth

    Object

    OAuth information associated with the user.

    _updatedAt

    Date

    The date and time when the user object was last updated.

    e2e

    Object

    End-to-end encryption information associated with the user.

    requirePasswordChange

    Boolean

    Indicates whether the user needs to change their password.

    customFields

    Object

    Additional custom fields associated with the user.

    settings

    Object

    User-specific settings.

    defaultRoom

    String

    The ID of the user's default room.

    ldap

    Boolean

    Indicates whether the user is an LDAP user.

    extension

    String

    The extension associated with the user.

    inviteToken

    String

    The token for inviting the user.

    canViewAllInfo

    Boolean

    Indicates whether the user can view all information.

    phone

    String

    The phone number associated with the user.

    reason

    String

    The reason associated with the user.

    federated

    Boolean

    Indicates whether the user is a federated user.

    federation

    Object

    Federation information associated with the user.

    banners

    Object

    Banner information associated with the user.

    importIds

    Array of strings

    An array of import IDs associated with the user.


    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.
    ESC

    Eddy AI, facilitating knowledge discovery through conversational intelligence