Bot Framework v4 basic bot sample
This bot has been created using [Microsoft Bot Framework][1], it shows how to:
- Use LUIS to implement core AI capabilities
- Implement a multi-turn conversation using Dialogs
- Handle user interruptions for such things as 'Help' or 'Cancel'
- Prompt for and validate requests for information from the user
- Demonstrate how to handle any unexpected errors
This sample requires prerequisites in order to run.
- [Required Prerequisites][41]
-
Clone the repository
git clone https://github.com/microsoft/botbuilder-samples.git
-
In a terminal, navigate to
samples/javascript_typescript/13.basic-bot
cd samples/javascript_typescript/13.basic-bot
-
Install modules
npm install
-
Build the bot source code
npm run build
-
Setup LUIS
Assuming prerequisites have been installed:
# log into Azure az login
# set you Azure subscription az account set --subscription "<azure-subscription>"
# Create LUIS service application msbot clone services --name "<your_bot_name>" --luisAuthoringKey <LUIS-authoring-key> --code-dir "." --location westus --sdkLanguage "Node" --folder deploymentScripts/msbotClone --verbose
-
Run the sample
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
- Navigate to
samples/javascript_typescript/13.basic-bot
folder - Select
basic-bot.bot
file
After creating the bot and testing it locally, you can deploy it to Azure to make it accessible from anywhere. To deploy your bot to Azure:
# login to Azure
az login
As you make changes to your locally running bot, you can deploy those changes to Azure Bot Service using a publish helper. See publish.cmd
if you are on Windows or ./publish
if you are on a non-Windows platform. The following is an example of publishing local changes to Azure:
# build the TypeScript bot before you publish
npm run build
# run the publish helper (non-Windows) to update Azure Bot Service. Use publish.cmd if running on Windows
./publish
To learn more about deploying a bot to Azure, see [Deploy your bot to Azure][40] for a complete list of deployment instructions.