Scripts let you add more advanced interactions to your chatbot, such as:
- Sending emails.
- Sending or retrieving data via other APIs.
- Sending messages with dynamic content.
- Displaying dates in specific formats.
Testing changes to your scripts
Changes to your scripts are stored in the chatbot's versions. To see changes you make to your script, you need to Deploy and Publish a new version of the chatbot. See Versions.
Chatbot scripts can send a maximum of one message to the user per script. Any subsequent messages you try to send within the same script will not be sent to the user. You can add multiple script bubbles to a passage if you need to send more than one dynamic message to a user.
Keep your content in passages
Scripts give you powerful capabilities, but writing a lot of chatbot-content inside your scripts can make it hard for the content creators to maintain the chatbot. Where possible, write your content in passages you direct the chatbot to, rather than in scripts.
Ending script execution
Wherever the script has finished executing, you must call the done() method to tell the chatbot to return to the conversation flow.
|User||Get and set user data, subscribe to stories and schedule notifications.|
|Channel||Send messages, display typing indicators, and manage handovers and handbacks.|
|Flow||Send the chatbot to a specific conversation or start a passage.|
|Util||Send emails to one or more email addresses.|