tokyo azure meetup #13 build bots with azure bot services

50
Building Bots with Azure Bot Service Kanio Dimitrov

Upload: tokyo-azure-meetup

Post on 20-Mar-2017

55 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: Tokyo azure meetup #13   build bots with azure bot services

Building Bots with Azure Bot Service

Kanio Dimitrov

Page 2: Tokyo azure meetup #13   build bots with azure bot services

Azure Functions

Page 3: Tokyo azure meetup #13   build bots with azure bot services

Azure Functions vs Web Jobs

Triggers Binging Outputs Dynamic Plan Serverless -> Azure Functions

Page 4: Tokyo azure meetup #13   build bots with azure bot services

Comparison

Page 5: Tokyo azure meetup #13   build bots with azure bot services

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.

Page 6: Tokyo azure meetup #13   build bots with azure bot services

Components Bot Builder SDK Bot Connector Developer Portal Bot Directory Emulator

Page 7: Tokyo azure meetup #13   build bots with azure bot services

Components

Page 8: Tokyo azure meetup #13   build bots with azure bot services

Experience

Page 9: Tokyo azure meetup #13   build bots with azure bot services

SDK.NET SDK

Node.js SDK

REST API

Bot Builder Open Source

Page 10: Tokyo azure meetup #13   build bots with azure bot services

Workflow Write Bot Register Connect to Channel

Skype Web Chat Direct Line REST API

Publish it Directory Review

Page 11: Tokyo azure meetup #13   build bots with azure bot services

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.

Page 12: Tokyo azure meetup #13   build bots with azure bot services

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.

Page 13: Tokyo azure meetup #13   build bots with azure bot services
Page 14: Tokyo azure meetup #13   build bots with azure bot services
Page 15: Tokyo azure meetup #13   build bots with azure bot services

Developer

Portal Register Connect to

Channels Test Publish Measure Manage

Page 16: Tokyo azure meetup #13   build bots with azure bot services
Page 17: Tokyo azure meetup #13   build bots with azure bot services
Page 18: Tokyo azure meetup #13   build bots with azure bot services
Page 19: Tokyo azure meetup #13   build bots with azure bot services

Azure Bot Service

Page 20: Tokyo azure meetup #13   build bots with azure bot services

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.

Page 21: Tokyo azure meetup #13   build bots with azure bot services

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.

Page 22: Tokyo azure meetup #13   build bots with azure bot services

Demo – Create Basic Bot

Page 23: Tokyo azure meetup #13   build bots with azure bot services

Authenticate

Page 24: Tokyo azure meetup #13   build bots with azure bot services

Process Message

Page 25: Tokyo azure meetup #13   build bots with azure bot services

Welcome Message

Page 26: Tokyo azure meetup #13   build bots with azure bot services

Activity

Page 27: Tokyo azure meetup #13   build bots with azure bot services

EchoDialog

Page 28: Tokyo azure meetup #13   build bots with azure bot services

EchoDialog - MessageReceiveAsync

Page 29: Tokyo azure meetup #13   build bots with azure bot services

EchoDialog - AfterResetAsync

Page 30: Tokyo azure meetup #13   build bots with azure bot services

Demo – Create Form Bot

Page 31: Tokyo azure meetup #13   build bots with azure bot services

Activity

Page 32: Tokyo azure meetup #13   build bots with azure bot services

Main Dialog

Page 33: Tokyo azure meetup #13   build bots with azure bot services

Message Received Async

Page 34: Tokyo azure meetup #13   build bots with azure bot services

Basic Form

Page 35: Tokyo azure meetup #13   build bots with azure bot services

Language Understanding Bot - Activity

Page 36: Tokyo azure meetup #13   build bots with azure bot services

Basic LUIS Dialog

Page 37: Tokyo azure meetup #13   build bots with azure bot services

Demo – Proactive Bot

Page 38: Tokyo azure meetup #13   build bots with azure bot services

Proactive Scenario

Page 39: Tokyo azure meetup #13   build bots with azure bot services

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

Page 40: Tokyo azure meetup #13   build bots with azure bot services

Get message & send to queue

Page 41: Tokyo azure meetup #13   build bots with azure bot services

Receive message from Azure Function

Page 42: Tokyo azure meetup #13   build bots with azure bot services

Function Binding

Page 43: Tokyo azure meetup #13   build bots with azure bot services

Function Code

Page 44: Tokyo azure meetup #13   build bots with azure bot services

https://qnamaker.ai/

Page 45: Tokyo azure meetup #13   build bots with azure bot services

Questions and Answers Bot

Page 46: Tokyo azure meetup #13   build bots with azure bot services

Continuous Integration When you setup continuous integration, the Azure's bot editor will be

disabled.

Page 47: Tokyo azure meetup #13   build bots with azure bot services

Setup

Page 48: Tokyo azure meetup #13   build bots with azure bot services

Demo – Local Debugging

Page 49: Tokyo azure meetup #13   build bots with azure bot services

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

Page 50: Tokyo azure meetup #13   build bots with azure bot services

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