Skip to content

Latest commit

 

History

History
 
 

basic-bot sample

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

Prerequisite

This sample requires prerequisites in order to run.

  • [Required Prerequisites][41]

To try this sample

  • 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

Testing the bot using Bot Framework Emulator v4

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

Connect to bot using Bot Framework Emulator v4

  • Launch Bot Framework Emulator
  • File -> Open Bot Configuration
  • Navigate to samples/javascript_typescript/13.basic-bot folder
  • Select basic-bot.bot file

Deploy the bot to Azure

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

Publishing Changes to Azure Bot Service

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

Getting Additional Help with Deploying to Azure

To learn more about deploying a bot to Azure, see [Deploy your bot to Azure][40] for a complete list of deployment instructions.

Further reading