/JSDayBot

This is a repository of the bot I created for the JSDay Canarias 2018 conference

Primary LanguageJavaScript

JSDay Canarias 2018 Bot

Demonstrate the core capabilties of the Microsoft Bot Framework

This bot has been created using Microsoft Bot Framework, based on the eduiConf bot built by szul

This sample shows how to:

  • Use LUIS to implement core AI capabilities
  • Use QnA Maker to implement core AI capabilities
  • 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 unexptected errors
  • Use Application Insights service for telemetry
  • Use Chatbase service for telemetry

To run this bot

  • In a terminal,

    cd JSDayBot
  • Install modules

    npm install
  • Create required services

  • Run the bot

    tsc && node ./lib/index.js

    NOTE: review the settings on the jsDay.bot and .env files to setup LUIS, QnA, Application Insights and Chatbase services

Prerequisite

Install TypeScript

In order to run this sample, you must have TypeScript installed. To install TypeScript:

  • Navigate to the TypeScript portal.
  • Click the Download button.
  • Follow the installation instructions for your development environment.

Testing the bot using Bot Framework Emulator

Microsoft Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on running locally or or running remotely in Microsoft Azure.

  • Install the Bot Framework Emulator from here

Connect to the bot using Bot Framework Emulator v4

  • Launch Bot Framework Emulator
  • File -> Open Bot Configuration and navigate to jsDay folder
  • Select jsDay.bot file

Deploy this bot to Azure

See DEPLOYMENT.md to learn more about deploying this bot to Azure and using the CLI tools to build the LUIS models this bot depends on.

Further Reading

Additional Resources

Dependencies

  • Restify Used to host the web service for the bot, and for making REST calls
  • dotenv Used to manage environmental variables

Project Structure

index.ts references the bot and starts a Restify server. bot.ts loads the main dialog router and determines how activities are processed.

Configuring the bot

The generator created a .env file with the two necessary keys botFilePath and botFileSecret. The botFilePath key is set to jsDay.bot. All of the services and their respective configuration settings are stored in the .bot file.

  • For Azure Bot Service bots, you can find the botFileSecret under application settings.
  • It is recommended that you encrypt your bot file before you commit it to your souce control system and/or before you deploy your bot to Azure or similar hosting service. There are two ways to encrypt your jsDay.bot file. You can use MSBot CLI to encrypt your bot file or you can use Bot Framework Emulator V4 to encrypt your bot file. Both options will product a botFileSecret for you. You will need to remember this in order to decrypt your .bot file.

Running the bot

tsc && node ./lib/index.js

Developing the bot

tsc && node ./lib/index.js