article by David Callaghan (Hermes Europe, UK), December 2019
Users fail because designs fail. Conversational design skills are an important asset for any bot developer, regardless of the development platform used. With chatbots you always build for two types of users:
1. new users that use a bot for the first time
2. expert users that did use the bot before
This article explains a solution that allows experienced users to skip a dialog in a bot-user interaction
Problem Statement
Consider a simple question, asking a user if they have a particular input and then following up with gathering that input. Rather than simply providing an endless loop of menus, actually validating the input and if the user enters an expected response continuing in the flow.
For example, asking a person for a Barcode:
A simple journey, but how should the bot react when the user answers the question (expert user) rather than clicking the list button. One way, is to simply repeat the menu option until they click the right button, for example:
Hope you agree that this user experience would not find many friends.
Solution
A better journey is to anticipate expert users and to validate the text input, and if they have entered the expected type, to simply continue and display the next logical step . Using Oracle Digital Assistant, to write a question and collection gathering flow, its as simple as outputting a List and then an Input component into the flow.
Implementation
The BotML code below shows the original dialog flow. Notice how the "haveBarcode" dialog flow state loops to itself when a user provides free text input instead of selecting an item in the list.
haveBarcode:
component: "System.List"
properties:
options: "Barcode,No Barcode"
prompt: "Do you have a barcode?"
transitions:
actions:
textReceived: "haveBarcode"
attachmentReceived: "haveBarcode"
locationReceived: "haveBarcode"
Barcode: "resetBarcode"
No Barcode: "bye"
next: "askBarcode"
resetBarcode:
component: "System.ResetVariables"
properties:
variableList: "barcode"
transitions:
next: "askBarcode"
askBarcode:
component: "System.Text"
properties:
prompt: "Please enter your barcode…"
variable: "barcode"
To improve the user experience, it is a simple as inserting a variable into the List and a MatchEntity component to check the expected type and skip to the next part of the flow. In the improved BotML, notice the "textInput" variable that is added to the System.List component state. The variable is of type string and holds the value a user types in.
haveBarcode:
component: "System.List"
properties:
options: "Barcode,No Barcode"
prompt: "Do you have a barcode?"
variable: "textInput"
transitions:
actions:
textReceived: "testBarcode"
attachmentReceived: "haveBarcode"
locationReceived: "haveBarcode"
Barcode: "askBarcode"
No Barcode: "bye"
next: "askBarcode"
To verify the barcode agains an entity, you use the System.MatchEntity component as shown in the BotML code below. If the user entered barcode value could be validated against the entity (referenced through the "barcode" variable) then the match transition is followed. Else, the nomatch transition is followed and the user is prompted to type in the barcode.
testBarcode:
component: "System.MatchEntity"
properties:
sourceVariable: "textInput"
variable: "barcode"
transitions:
actions:
match: "sayBarcode"
nomatch: "resetQuestion"
By doing this, we can trap the user input, check if they’ve entered something sensible and continue in the flow rather than the endless loop of menus.
Related Content
TechExchange: All 2-Minutes Oracle Digital Assistant Tech Tip Videos on YouTube
TechExchange Quick-Tip: How-to use the maxPrompts property for input validation
TechExchange Quick-Tip: How To Implement a textReceived Action Transition Behavior in QnA