tokyo azure meetup #13 build bots with azure bot services
TRANSCRIPT
Building Bots with Azure Bot Service
Kanio Dimitrov
Azure Functions
Azure Functions vs Web Jobs
Triggers Binging Outputs Dynamic Plan Serverless -> Azure Functions
Comparison
Microsoft Bot Framework
The Microsoft Bot Framework is a comprehensive offering that you use to build and deploy high quality bots for your users to enjoy wherever they are talking.
Components Bot Builder SDK Bot Connector Developer Portal Bot Directory Emulator
Components
Experience
SDK.NET SDK
Node.js SDK
REST API
Bot Builder Open Source
Workflow Write Bot Register Connect to Channel
Skype Web Chat Direct Line REST API
Publish it Directory Review
Review Guidelines Your bot must do something meaningful that adds value to the user
(e.g., respond to basic commands, have at least some level of communication etc.)
The bot profile image, name, keywords and description must NOT: Be offensive or explicit; Include third party trademarks, service marks or logos; impersonate or imply endorsement by a third party; use names unrelated to the bot; use Microsoft logos, trademarks or service marks unless you have permission
from Microsoft; be too long or verbose. The description should be 8-10 words.
Review Guidelines Microsoft Bot Framework does not currently support payments within
bots. Your bot may not transmit financial instrument details through the user to bot
interface;
However, your bot may transmit links to secure payment services to users but you must disclose this in your bot's terms of use and privacy policy (and any profile page or website for the bot) before a user agrees to use your bot;
You may not publish bots on Skype that include links or otherwise direct users to payment services for the purchase of digital goods.
Developer
Portal Register Connect to
Channels Test Publish Measure Manage
Azure Bot Service
FilesFile Description
Bot.sln The Microsoft Visual Studio solutions file. Used locally if you set up continuous integration.
commands.json This file contains the commands that start debughost in Task Runner Explorer when you open the Bot.sln file. If you don't install Task Runner Explorer, you can delete this file.
debughost.cmd This file contains the commands to load and run your bot. Used locally if you set up continuous integration and want to debug your bot locally. For more information, see Debugging C# bots built using the Azure Bot Service on Windows. The file also contains your app ID and password. You would set the ID and password if you want to debug authentication. If you set these, you must provide the ID and password in the emulator, too.
function.json This file contains the function’s bindings. You should not modify this file.
Files
File Description
host.json A metadata file that contains the global configuration options affecting the function.
project.json This file contains the project’s NuGet references. You should only have to change this file if you add a new reference.
project.lock.json This file is generated automatically, and should not be modified.
readme.md This file contains the function’s bindings. You should not modify this file.
Demo – Create Basic Bot
Authenticate
Process Message
Welcome Message
Activity
EchoDialog
EchoDialog - MessageReceiveAsync
EchoDialog - AfterResetAsync
Demo – Create Form Bot
Activity
Main Dialog
Message Received Async
Basic Form
Language Understanding Bot - Activity
Basic LUIS Dialog
Demo – Proactive Bot
Proactive Scenario
Resources• Azure Storage (used to create the queue)• Azure Bot Service (your bot) • logic that receives the message from user• adds the message to Azure queue• receives the triggers from Azure Function• sends back the message it received from trigger’s payload
• Azure Function App (a queueTrigger Azure Function) • Triggered whenever there is a message in the queue• Communicates to the Bot service via Direct Line
• Everything is pre-configured
Get message & send to queue
Receive message from Azure Function
Function Binding
Function Code
https://qnamaker.ai/
Questions and Answers Bot
Continuous Integration When you setup continuous integration, the Azure's bot editor will be
disabled.
Setup
Demo – Local Debugging
Workflow Package Restore:
cmd prompt -> folder with project.json -> dotnet restore Run debughost.cmd to load and run your bot Copy the endpoint that debughost is listening on Start the framework’s emulator Paste the endpoint into the address bar Append /api/messages to the endpoint Leave the Microsoft App Id and Microsoft App Password fields blank Click Connect Start playing with the bot by typing a message
Workflow You can see the logs in the console window If you want to do breakpoint debugging in Visual Studio 2015
Stop the DebugHost.cmd script Load the solution for your project Click Task Runner Explorer at the bottom of your Visual Studio window Bot loading up in the debug host environment in the Task Runner Explorer window Your bot is now live When using the emulator, responses will be visible in Task Runner Explorer breakpoints are hit only after clicking Start in the Visual Studio environment (attach
to the Azure Function host (func command from Azure Functions CLI)) For compiling errors check Task Runner Explorer