Skip to main content

activeAgent


name: node description: widget rendering element ---# activeAgent

type Config = {
activeAgent: number;
};

Controls which agent will respond to the user's messages. The default value is 0, indicating that no specific agent is assigned.

Example of usage:

const chat = new ChatBot(node, { activeAgent: 1 });

Get current state of activeAgent

To retrieve the current agent setting, use the getConfig method:

const activeAgent = chat.getConfig().activeAgent;

Set which agent will respond to the user's messages

To change the agent during runtime, use the setConfig method:

chat.setConfig({ activeAgent: 1 });

node

type Config = {
node: HTMLElement;
};

Represents the HTML element where the ChatBot widget will render.

Example of usage:

const chat = new ChatBot(node, { node: document.getElementById('chat-container') });

Get current value of node property

To access the current node setting, use the getConfig method:

const node = chat.getConfig().node;