Skip to content

epomatti/botframework-bots

Repository files navigation

Microsoft Bot Framework Exercise

Demonstrate the core capabilities of the Microsoft Bot Framework

This bot has been created using Bot Framework, it shows how to create a simple bot that accepts input from the user and echoes it back.

To run the bot

There are multiple ways of making your bot session data persistent.

Choose your storage strategy according to the storage factory.

  • Option 1: Memory, no need to create resources

  • Option 2: Cosmos DB:

group='rg-bot'
location='eastus2'
cosmosAccount='cosmos-botframework-999'
cosmosDatabase='greetingbot'

az group create -n $group -l $location
az cosmosdb create -n $cosmosAccount -g $group
az cosmosdb sql database create -a $cosmosAccount -g $group -n $cosmosDatabase

az cosmosdb sql container create \
  -a $cosmosAccount \
  -g $group \
  -d $cosmosDatabase \
  -n 'messages' \
  --partition-key-path '/messages'    
  • Option 3: Storage Account:
group='rg-bot'
location='eastus2'
storage='stbotfrmk999'

az group create -n $group -l $location

az storage account create \
  -n $storage \
  -g $group \
  -l $location \
  --kind StorageV2 \
  --sku Standard_LRS

# get the connection string and use it here
az storage container create -n 'messages' --connection-string '<CONNECTION_STRING>'

Install global CLI dependencies

# "yo" and "generator-botbuilder"
yarn global add yo generator-botbuilder

Start the bot

yarn install
yarn start

Testing the bot using Bot Framework Emulator

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 latest version from here

Connect to the bot using Bot Framework Emulator

  • Launch Bot Framework Emulator
  • File -> Open Bot
  • Enter a Bot URL of http:https://localhost:3978/api/messages

Deploy the bot to Azure

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

References

Create a bot using JavaScript

Further reading