Skip to main content

user

type User = {
id: TID;
name: string;
avatar?: string;
}

Controls the information about the current user interacting with the chatbot widget. This includes the user's unique identifier, display name, and optionally, their avatar image URL.

Default Property Value

No default value is provided for the user property. It is mandatory to provide this property for the widget to function correctly.

Example of Usage

const user = { id: 100, name: "Me", avatar: "https://some.com/i.png" };
const chat = new ChatBot(node, { user });

Updating Information About the Current User

The user property can be updated after the widget initialization using the setConfig method.

const updatedUser = { id: 101, name: "You", avatar: "https://another.com/avatar.png" };
chat.setConfig({ user: updatedUser });

Accessing the Information About the Current User

To access the current user configuration, use the getConfig method.

const userInfo = chat.getConfig().user;
console.log(userInfo);
// Output example: { id: 100, name: "Me", avatar: "https://some.com/i.png" }