The first part of the tutorial can be found here – https://chatbotslife.com/building-a-weather-bot-with-bot-framework-composer-fa62b7cc9623
The dialog box contains one or more triggers. Each trigger consists of one or more actions, which are a set of instructions that the bot performs. Dialogs can also call other dialogs and pass values back and forth between them.
In this tutorial, you will learn how to:
- Add dialogs to the base robot.
- Run the bot locally and test it.
The main task of the bot is to report the current weather conditions.
To do this, you create a dialog box that:
- Prompts the user to enter a zip code to be used as the weather search location.
- Invokes the external API to retrieve weather information for the specified zip code.
- Start the composer.
- Select the weather_bot bot project from the Recent Bots list on the home page.
- Next, select three points for your Weather_bot bot project. Then click + Add dialog box.
- In the popup window, type the following:
- Name: getWeather
- Description: Get current weather conditions.
- Click OK to create a dialog box.
- Now select the + button below the BeginDialog dialog event in the middle of the writing pad. Click Send Reply.
- To the right of the answer editor, type the following:
- Bot Response Copy
- We’ll add more features later, like retrieving the weather forecast, but first you need to connect the getWeather dialog to the bot with the trigger.
You can split the conversation progress into different dialog boxes and then paste them. The following steps explain how to connect a newly created getWeather dialog to the main dialog.
- Select the weather_bot dialog box. Then go to the right and change the Sensor Type setting to Regular Expression Sensor.
- Now select the three points next to the weather_bot dialog on the left and click + Add New Trigger.
- In the Create Trigger pop-up window, enter the following information:
- Enter both What is the name of this trigger (RegEx) and Enter the text fields of the regex template weather.
- Click Submit.
- This tells the bot to search for the word weather in any incoming message. Regular expression patterns are usually much more complex, but this is sufficient for the purpose of this example.
- In the center of the writing pad, select the + button below the weather trigger detected trigger.
- Hover over the dialog box manager and click Start New Dialog Box.
- In the dialog on the right, select getWeather. Now your weather robot is connected to the weather trigger.
You can now test your robot and the trigger and dialog box you added to it.
- Go to the upper right corner of the Composer and click Start Bot. It may take a while for the bot to start.
- If the bot is still running from the previous tutorial, you can select Restart bot. This will update the bot runtime application with all new content and settings.
- The runtime management of the local bot opens. Click Open Chat. The Web Chat screen on the right appears.
- Now test different sentences. Note that the bot sends a message to the getWeather dialog if the word weather is in your answer. Otherwise, the bot sends a message to the Unknown Purpose launcher.