This is a sample bot app that uses the bot-graph-dialog extension for dynamically loading graph-based dialogs.
Use this app as a reference for using the bot-graph-dialog
extension.
Read more about the motivation for developing this extension here
Note- This page assumes you're already familar with the core concepts of bots and how to run them locally on your machine. You'll need to have a bot provisioned in the developer portal. Follow these instructions (look for the Registering your Bot with the Microsoft Bot Framework section) to register your bot with the Microsoft Bot Framework.
git clone https://github.com/Azure/bot-trees.git
cd bot-trees
npm install
Create a config/dev.private.json
base on the config/dev.sample.json
file. Edit it and add your bot App id and password.
After connecting your bot to this endpoint, run npm start
.
NOTE- Latest changes require that you provide an implementation for a state storage where the bot keeps the dialog's state for production environments. The index.js
file was modified to apply this change as an example and use Azure Cosmos DB as the state storage for the bot. More information can be found here.
There are a few sample files in the root of this project:
This is the default sample which loads the different dialogs from the bot/scenarios/dialogs.json
file.
It adds each of the scenarios on the bot and binds it to the relevant RegEx as defined in the scenario.
This file demonstrates how to reload scenarios on-demand in cases that a scenario was modified on the backend. In this scenario, if a user was in the middle of a dialog that was updated, he would get a message saying the dialog was changed and that he will need to restart the dialog.
To test this scenario, after starting a dialog such as the stomachPain
by sending stomach
to the bot:
bot/scenarios/stomachPain.json
file, and maybe the text of the first question, then save the file.http://localhost:3978/api/load/stomachPain
to reload the scenario.Comment If the version
field in the root of the dialog object is specified, this will be considered as the scenario version. If the version was not specified, the bot will assign a version by hashing the content of the json file.
This file demonstrates how to use LUIS in order to extract a user intent, and then branch to the next scenario based on the result that was received from LUIS.