Microsoft Bot Framework is a comprehensive offering to build and deploy high quality bots for your users to enjoy in their favorite conversation experiences. Developers writing bots all face the same problems: bots require basic I/O; they must have language and dialog skills; they must be performant, responsive and scalable; and they must connect to users – ideally in any conversation experience and language the user chooses. Bot Framework provides just what you need to build, connect, manage and publish intelligent bots that interact naturally wherever your users are talking – from text/SMS to Skype, Slack, Facebook Messenger, Office 365 mail and other popular services. This lab is to setup a collaboration reserve Azure bot with language understanding, Q&A, translator and spell check service. User could chat with bot with more than 60 languages e.g. Chinese, English, Japanese etc. to reserve the restaurant and check reviews.
You must have the following to complete this lab:
- Azure Subscription
- Windows 10
- Microsoft Visual Studio 2017 Community (latest update)
- Bot Framework Emulator (latest update)
This Hands-on lab includes the following exercises:
Estimated time to complete this lab: 90 minutes.
-
Login Azure portal with provide Azure subscription
-
Create a notepad file, copy and paste below notes, save as config.txt at C:\lab\config.txt.
<appSettings> <!-- Your BotId, Microsoft App Id and your Microsoft App Password--> <add key="BotId" value="" /> <add key="MicrosoftAppId" value="" /> <add key="MicrosoftAppPassword" value="" /> <!-- Azure bing spell check --> <add key="IsSpellCorrectionEnabled" value="true" /> <add key="BingSpellCheckApiKey" value="" /> <!-- Azure translator --> <add key="AzureTranslatorApiKey" value="" /> <!-- Azure bot storage to trigger message --> <add key="AzureWebJobsStorage" value="" /> <!-- QnA maker --> <add key="QnAmakerUriBase" value="" /> <add key="KnowledgeBaseId" value="" /> <add key="AuthorizationKey" value="" /> <!-- Luis --> <add key="LuisApplicationID" value="" /> <add key="LuisAuthoringKey" value="" /> </appSettings>
-
Create a Web App Bot Service
-
Create a new Resource Groups
BOTRG
click Add at top panel. (rememberBOTRG
, please create all of services within this resource group) -
Then entry
Web App bot
. A new blade will open with information about theWeb App Bot
-
In the Bot Service blade, provide the requested information about your bot as specified in the table below the image.
-
Entry your [Bot Service Name], entry [App Name] in App name section, choose lab provided [Azure Subscription] in Subscription section, select East Asia at Location section, click Bot template section, select Basic Bot(C#) template, click Select. Click and create new app service plan in App service plan/Location section, select East Asia at Location section at output panel.
-
Unable Application Insights currently
-
Click Create
-
-
Click upper Notification link of right-hand, if resource created successfully, check if bot service created successfully.
-
Create a new Azure Storage Account, select Resource Groups
BOTRG
just created. Entrybootcampbotsa
at Storage account name -
Click Access Keys panel in
bootcampbotsa
just created. Copy Connection string section value to C:\lab\config.txt
-
-
Create a Translator Text service
-
Click Create New Resource link found on the upper left-hand corner of the Azure portal, entry
Translator Text
in filter panel, click enter keyboard, select Translator Text service, click Create -
Entry
New Translator Service Name
of your service, choose lab provided Azure Subscription in Subscription section, select S1 in Pricing Tier section, select your resource group at Resource Group section -
Click Create
-
Click upper Notification link of right-hand, if resource created successfully, click Go to resource to open service you just created.
-
Click Keys in RESOURCE MANAGEMENT section, copy KEY 1 into C:\lab\config.txt
-
-
Create a Bing Spell Check service
-
Click Create new resource link found on the upper left-hand corner of the Azure portal, entry Bing Spell in filter panel, click enter keyboard, select Bing Spell Check v7 service, click Create
-
Entry
New Spell Check Service Name
of your service, EntryNew Translator Service Name
of your service, select S1 in Pricing tier section, select your resource group at Resource group section, check on Confirm condition. -
Click Create
-
Click upper Notification link of right-hand, if resource created successfully, click To to resource to open service you just created.
-
Click Keys in RESOURCE MANAGEMENT section, copy KEY 1 into C:\lab\config.txt
-
-
Create a LUIS service
-
Open LUIS portal http://www.luis.ai, click Log****in, entry lab provided [Azure Subscription] and [Password] to login
-
Click Create new app link found on the upper left-hand corner of the LUIS portal, entry
LUIS name
in Name section, Click Done -
Click Prebuilt domains link found on the bottom left-hand corner of the LUIS portal, entry
res
in the filter panel, click Add Domain of outputRestaurantReservation
domain -
Entry
pla
in the filter panel, click Add Domain of output Places domain -
Click Intents link found in left panel, find
Places.GetReviews
and click, entrystarbucks reviews
at utterance entries to add new utterance, click enter keyboard -
Click
starbucks
word in new utterance added, entryplacename
at pop-up window filter panel, clickPlaces.PlaceName
-
Click Train link found on the upper right-hand corner of the LUIS portal, once status shows complete, click publish to on the upper right-hand corner to publish LUIS app to production
-
Create a notepad, save as config.txt.
-
Click MANAGE tab at upper panel, save Application ID at left-hand Application Information panel to C:\lab\config.txt, save Authoring Key at left-hand Keys and Endpoint panel to C:\lab\config.txt
-
-
Create a QnA maker service
-
Click Create new resource link found on the upper left-hand corner of the Azure portal, entry QnA in filter panel, click enter keyboard, select QnA Maker service, click Create
-
Entry
QnA Maker Service Name
in Name section, choose lab providedAzure Subscription
in Subscription section, select West US in Location section, select S0 in Management price tier section, select S in Pricing tier section, entryApp Name
in App name section, select West US at Search location section. -
Click Create
-
Open QnA maker portal https://www.qnamaker.ai/, click Create a knowledge base at upper tab.
-
Under section Step 2, select Microsoft in Microsoft Azure Directory ID section, choose lab provided
Azure Subscription
in Azure subscription name section, select QnA maker Service Name which created by pervious step in Azure QnA service section. -
Under section Step 3, entry your
Knowledge Base Name
in Name your KB section. -
Under section Step 4, click c, select C:\lab\qnamaker.xlsx to upload
-
Click Create your KB at the bottom.
-
Under your created QnA Maker App, click Save and train at upper of right-hand corner.
-
After train completed, select PUBLISH at upper panel, click Publish
-
After publish completed, go to SETTING panel, scroll down to the bottom, copy
Knowledge Based ID
,QnAmakerUriBase
andAuthorizationKey
found at POST /knowledgebases/Knowledge Based ID
/generateAnswerHost:
QnAmakerUriBase
Authorization:
AuthorizationKey
into C:\lab\config.txt, save config.txt
-
-
Verify C:\lab\config.txt, to check if below keys are all setup.
-
Double click Microsoft.Bot.Sample.SimpleEchoBot.sln, open Bot solution with Visual Studio 2017 community.
-
Double click Web.config under project Microsoft.Bot.Sample.SimpleEchoBot, replace
< appSettings…</ appSettings>
with values in C:\lab\config.txt -
Entry Root at upper of right-hand filter, double click RootLuisDialog.cs from filter result, replace
LuisModel("[Application ID]", "[Authoring Key]")
with values in C:\lab\config.txt, Ctrl+S to save, clear filter. -
Right click project name Microsoft.Bot.Sample.SimpleEchoBot at upper of right-hand corner, select Build
-
Click debug with IIS Express (Microsoft Edge) upper of middle, copy opened [Local URL] with port e.g. http://localhost:3984/
-
Open Bot Emulator at Desktop, click Create a new bot configuration, entry
Bot Name
entryLocal URL/api/messages
in Endpoint URL section. E.g http://localhost:3984//api/messages, click Save and connect, save configuration file under C:\lab\Bot Name
.bot -
Verify if Bot Emulator return 200 at LOG section with Welcome User!
-
Entry some utterance to check e.g.
KFC reviews
. If return like below then success. Now your local bot is working, and connected to LUIS, translator, spell check and QnA maker. Next step we need deploy your local bot onto Azure. -
Stop debug by click Stop Debugging at middle of upper panel.
-
Right click project name Microsoft.Bot.Sample.SimpleEchoBot at upper of right-hand corner, select Publish
-
Select Microsoft Azure App Service in left panel Publish section, select Select Existing, click Publsih, login with lab provided
Azure Subscription
andPassword
selectAzure Subscription
select your resource group, clickBot Service Name
created in pervious step, click OK -
Verify if publish succeeded.
-
Login Azure portal with provide
Azure subscription
-
Click All resources at left-hand panel, entry
Bot Service Name
to find your bot service and click, select Test in Web Chat under Bot management section. -
Entry test utterance (multiple languages) to verify your bot service on Azure
e.g.
“I wang to book a room at KFC”
“KFC reviews”
Click Channels under Bot management section, click Edit of Web Chat, copy first Secret Keys at the top and paste to a new notepad, copy and paste URL value in SRC of Embed code to notepad, replace YOUR_SECRET_HERE with Secret Keys just saved
Open Microsoft Edge, put whole URL to URL section and search, you will find a web chat bot is ready, it also could integrated as a frame.
-
Entry test utterance (multiple languages) to verify your web chat bot.