What JavaScript triggers do I add in Storyline when setting up the chatbot?
Reply
Posted on 6/21/2025
Please type your reply.
@support
When it comes to the chatbot setup, you have two options.
Option 1 (easier) - download the starter .story file from the Use the Chatbot tab on the same page where you created the chatbot. The starter .story file will contain all triggers and variables that are needed to set up the chatbot in Storyline, so the JavaScript code and all other triggers will already be there for you. You will only need to update the variable clabsAnswersWidgetID and that is it.
Option 2 (harder) - manually add all JavaScript code. First, make sure to create a variable clabsAnswersWidgetID and set its value to the ID given to you when you created the widget. Then, you can copy the trigger code either from the snippets below.
To initialize the widget when the course loads (this must complete before the user attempts to engage with the chatbot):
To show the loading screen: document.getElementsByClassName('clabs_waiting_container')[0].style.display = 'flex';
To hide the loading screen: document.getElementsByClassName('clabs_waiting_container')[0].style.display = 'none';
To turn the microphone ON: clabsAudioStartMicrophone();
To turn the microphone OFF: clabsAudioStopMicrophone(false);
To completely disable the microphone: clabsAudioReleaseMicrophone();
To send the user's message to the chatbot (assumes the message is stored in the variable clabsAnswersUserMessage):
clabsAudioStopMicrophone(false); let player = GetPlayer(); let message = player.GetVar('clabsAnswersUserMessage'); clabsChatbotProcessUserMessage({text: message});
The name of the variable that will contain the chatbot response after the message is processed: clabsAnswersResponseMessage