Hands-On Chatbots and Conversational UI Development
上QQ阅读APP看书,第一时间看更新

Default block

Alongside the Welcome message block, there is a Default answer block. This block is used by the chatbot as response to any input from the user that it does not understand. Go ahead and change the contents of the block as follows:

Now test the bot by typing in a question to the chatbot on Messenger. You can see how the default message gets used:

Let us now explore how to handle NL input so that users don't end up with this default response. To set up the chatbot to understand NL inputs, find and click the Set Up AI option in the menu on the far left of the page. This is where we will specify NL input templates and their corresponding chatbot responses:

Click ADD AI RULE. You will see two fields. Type user utterances and bot responses in the respective fields:

Bot responses can either be text or blocks. By providing block names, the chatbot can be redirected to appropriate blocks when the user chooses to type responses rather than push buttons. After having added a few rules, go back to Messenger and try the bot with the NL inputs:

You can also add an element of uncertainty and randomness by choosing the random flag in bot response and add more than one response. The bot would then choose one response randomly.