Skip to main content
Version: 3.0.0-LTS

Component Specific Actions & Exposed Variables

This guide covers component-specific actions for the Chat Component and its exposed variables. To learn how to build a chatbot, refer to the Chat Component Overview guide. For more information on Chat Component Properties, check out the Properties guide.

Component Specific Actions (CSA)

Action
Description
How to Access
sendMessage( )Sends a message in the chat.Employ a RunJS query (for e.g. components.chat1.sendMessage({message: "Hey! How can I help you?", type: "response"})) or trigger it using an event.
clearHistory( )Clear chat history.Employ a RunJS query (for e.g. components.chat1.clearHistory()) or trigger it using an event.
deleteMessage( )Delete a message using the MessageIDEmploy a RunJS query (for e.g. components.chat1.deleteMessage(MessageID)) or trigger it using an event.
downloadChat( )Download the chat in JSON format.Employ a RunJS query (for e.g. components.chat1.downloadChat()) or trigger it using an event.
setHistory( )Sets the chat history.Employ a RunJS query (for e.g. components.chat1.setHistory(History Object)) or trigger it using an event.
appendHistory( )Appends chat history.Employ a RunJS query (for e.g. components.chat1.appendHistory(Message Object)) or trigger it using an event.
setResponderAvatar( )Sets Responder's Avatar.Employ a RunJS query (for e.g. components.chat1.setResponderAvatar(Image URL)) or trigger it using an event.
setUserAvatar( )Sets User's Avatar.Employ a RunJS query (for e.g. components.chat1.setUserAvatar(Image URL)) or trigger it using an event.

Exposed Variables

Variable
Description
How to Access
historyAccess the chat history.Accessible dynamically with JS (for e.g., {{components.chat1.history}}).
isHistoryLoadingIndicates if the history is loading.Accessible dynamically with JS (for e.g., {{components.chat1.isHistoryLoading}}).
isResponseLoadingIndicates if the response is loading.Accessible dynamically with JS (for e.g., {{components.chat1.isResponseLoading}}).
isInputDisabledIndicates if the input is disabled.Accessible dynamically with JS (for e.g., {{components.chat1.isInputDisabled}}).
isVisibleIndicates if the component is visible.Accessible dynamically with JS (for e.g., {{components.chat1.isVisible}}).
lastMessageHolds the last message object of type message in the array.Accessible dynamically with JS (for e.g., {{components.chat1.lastMessage}}).
lastResponseHolds the last message object of type response in the array.Accessible dynamically with JS (for e.g., {{components.chat1.lastResponse}}).