With even a simple bot, it is a good practice to provide a help command. You'll also want to provide a way for users to back out.
-
Click
+ New Dialogin the left hand explorer. You'll see a popup window. -
Give this new dialog the name:
help -
Click submit, and you'll land in the editor view for the new help dialog.
Composer created this new dialog with one
BeginDialogtrigger pre-configured. -
With the
BeginDialogtrigger selected, use the+button at the bottom of the flow, chooseSend a response -
In the property editor on the right side, set the text of the activity to:
I am a weather bot! I can tell you the current weather conditions. Just say WEATHER.Next, let's wire this new dialog up to the Main dialog (your bot's brain).
-
In the left hand explorer, click on
weatherBot.Mainat the top of the list. -
In the right hand property pane, find the "Language Understanding" section and click the "Add" button at the bottom. This will reveal 2 new fields, allowing you to define a new intent.
-
Set the
Intentfield to:helpSet the
Patternfield to:help -
In the left hand explorer, click `+ New Trigger'
-
In the resulting dialog box, select
Handle an Intent, then choose the newhelpintent. Submit the dialog. -
In the flow editor, click the
+button at the bottom of the empty flow. -
Choose
Dialogs management >and then selectBegin a new dialog -
In the right hand property editor, select the
helpdialog. -
Click
Reload botand open it in the emulator.
Now, in addition to giving you the current weather, your bot can also offer help.
However, notice that once you start the weather dialog by saying weather, your bot doesn't know how to provide help. Let's fix this!
-
In Composer's left hand explorer, navigate back to the
getWeatherdialog. Make sure to highlight theBeginDialogtrigger. -
Select the
Bot Asksnode in the flow that saysWhat is your zipcode? -
In the right hand property editor, set
Allow Interruptionstotrue
This tells Bot Framework to consult the parent dialog's recognizer, which will allow the bot to respond to
helpat the prompt as well. -
Hit
Reload Botand open it in the emulator.
Say weather to your bot. It will ask for a zipcode.
Now say help. It'll provide the global help response, even though that intent and trigger are defined in another dialog. Interruptions are a powerful way to make complex bots - we'll come back to that later.
For now, let's add one more global function - a cancel command.
-
In Composer's left hand explorer, click the
+ New Dialogbutton again. -
Give this new dialog the name:
cancel -
Use the
+button at the bottom of the flow, chooseSend a response -
In the property editor on the right side, set the text of the activity to:
Canceling! -
Use the
+button again, this time chooseDialog management >, thenCancel all dialogsWhen triggered, this will cause the bot to cancel any active dialogs, and send the user back to the main dialog.
-
In the left hand explorer, click on
weatherBot.Mainat the top of the list. -
In the right hand property pane, find the "Language Understanding" section and click the "Add" button at the bottom. This will reveal 2 new fields, allowing you to define a new intent.
-
Set the
Intentfield to:cancel -
Set the
Patternfield to:cancel -
In the left hand explorer, click `+ New Trigger'
-
In the resulting dialog box, select
Handle an Intent, then choose the newcancelintent. Submit the dialog. -
In the flow editor, click the
+button at the bottom of the empty flow. -
Choose
Dialog management >and then selectBegin a new dialog -
In the right hand property editor, select the
canceldialog. -
Click
Reload botand open it in the emulator.
Say weather to your bot. It will ask for a zipcode.
Now say help. It'll provide the global help respons.
Now, say cancel - notice, the bot doesn't resume the weather dialog. Instead, it confirms the cancelation, and waits for your next message.









