Bot Framework v4 message routing bot sample
This samples shows how to:
- Handle user interruptions for such things as Help or Cancel
- Prompt for and validate requests for information from the user
- [Node.js][4] version 8.5 or higher
# determine node version
node --version
- Clone the repository
git clone https://github.com/microsoft/botbuilder-samples.git
- In a terminal, navigate to
javascript_nodejs/09.message-routing
cd javascript_nodejs/09.message-routing
- Install modules
npm install
- Start the bot
npm start
Microsoft Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
- Install the Bot Framework emulator from here
- Launch Bot Framework Emulator
- File -> Open Bot Configuration and navigate to
javascript_nodejs/09.message-routing
folder - Select
message-routing.bot
file
To clone this bot, perform the following:
- Run the following command from the project directory:
msbot clone services --name "<NAME>" --folder deploymentScripts/msbotClone --location "e.g, westus" --appId <YOUR APP ID> --appSecret <YOUR APP SECRET PASSWORD>
NOTE: You can obtain your appId
and appSecret
at the Microsoft's Application Registration Portal
- Note the secret generated by
MSBot
. - The secret key is used later for the emulator and configuration.
The secret used to decrypt <NAME>.bot is:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
NOTE: This secret is not recoverable and you should store this secret in a secure place according to best security practices.
Your project may be configured to rely on this secret and you should update it as appropriate.
- Inspect Bot configuration file.
- The
msbot clone
command above generates a bot configuration file. - The name of the bot configuration file is
<NAME>.bot
, where<NAME>
is the name of your bot used in themsbot clone
step. - The configuration file can be loaded by the Microsoft Bot Framework Emulator.
- Bot Framework Documentation
- Bot basics
- Activity processing
- LUIS
- Prompt Types
- Azure Bot Service
- Channels and Bot Connector Service
- QnA Maker
- Restify Used to host the web service for the bot, and for making REST calls
- dotenv Used to manage environmental variables
index.js
references the bot and starts a Restify server. bot.js
loads the dialog type you selected when running the generator and adds it as the default dialog. dialogs.js
contains the list of sample dialogs.
Update .env
with the appropriate keys:
- App ID and Key for registered bots.
node ./index.js
nodemon ./index.js