beerRecommender
Recommend beers to try based on user preferences.
This bot has been created using Microsoft Bot Framework.
My additions to the BasicBot from the SDK:
- Uses custom LUIS choice prompt class that first looks for LUIS intents and if not found, prevents a list of valid options
- Uses Bing Maps API to provide location of beer stores near user
- Uses rich cards
- Built in under 3 Days
Things I'd like to improve:
- Add more dialogue, especially for the greeting
- Use an API for beer styles and for creating LUIS intents for those styles
- Test edge cases. This was built for speed and there's likely a lot of user input that doesn't match the correct intent
To run this bot
- In a terminal,
cd beerRecommender
- Install modules
npm install
- Create required services
- Run the bot
tsc && node ./lib/index.js
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
beerRecommender
folder - Select
beerRecommender.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
- Bot Framework Documentation
- Bot basics
- Activity processing
- LUIS
- Prompt Types
- Azure Bot Service Introduction
- Channels and Bot Connector Service
- QnA Maker
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 beerRecommender.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
beerRecommender.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 abotFileSecret
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