3 Get Familiar with Rivescript
Last updated
Last updated
Develop a chatbot script that demonstrates several useful features and patterns in programming a conversation.
Any direct links to headings within the Rivescript documentation no longer work. Therefore, you will want to do a search for a keyword in the browser to find the content. We will update this page if we find a better way to link directly to the desired location in the Rivescript documentation.
Let's get familiar with the syntax of RiveScript and how it will provide the logic of your chatbot. For each item below carefully look at the documentation for RiveScript to understand the options available to you as you determine what is possible with your chatbot.
Read first section of The Code, Explained in the Rivescript documentation. Pay close attention to the "Important Note" in the reading that describes the importance of using lowercase with triggers.
Create four random replies to "hello" for your chatbot.
Define a single trigger (a trigger is the user input that starts with a "+" in the script) that will respond to these two user questions - "What do you do?" or "What can you do?" with a bot answer that you choose. For example, you could respond to the user with "I do very little at the moment." Hint: use the "alternatives and optionals" in RiveScript.
Use a redirection to your "hello" trigger when the user inputs "Hey". Basically, make your bot respond the same way to hello or hey.
Create a reply to "My name is Sue" (or any name). In your chatbot response, use the person's name---like, "Nice to meet you Sue, my name is ChattyBot." Hint: Use an open-ended trigger with a wildcard.
Have your bot kick-off the conversation with a question when it starts so the visitor knows how to continue the conversation. Also, add the needed script to listen for a response to that question and respond. Take a look at this example on short discussions.
Finally, choose two other features of RiveScript syntax to implement in your bot.
Have your chatbot working with the features described above and be prepared to demonstrate and explain how it works.