Create a script

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.

Message limits

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.
See done(err).

Chatbot methods

Chatbot scripts are written in JavaScript, with some additional libraries provided within the platform (see Provided libraries). The chatbot also provides methods for most of the tasks you can accomplish within the inGenious AI platform:

Namespace  
User Get and set user data, subscribe to broadcasts, 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.
Analytics Send additional attributes to Mixpanel.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.