Breaking into Bots

40

Transcript of Breaking into Bots

Page 1: Breaking into Bots
Page 2: Breaking into Bots

Introduction

To Bots

Page 3: Breaking into Bots

What Can Bots Do?

@Saelia

Page 4: Breaking into Bots

Microsoft Knowledge CloudTap into vast information, facts & actions on people, places and things from the web or your circle

Microsoft Bot FrameworkBuild your own conversational agents, and connect them wherever your users are talking

Microsoft Cognitive ServicesGive smarts to your experiences with cutting-edge technologies for speech, vision, language and knowledge understanding

Build and deploy your web service with Azure’s industry-leading Platform-as-a-Service (PaaS) cloud infrastructure.

Microsoft Bot Distribution Channels (Bing, Skype, Cortana/Win10, and third party clients like Slack, Kik, and Messenger)

Conversations as a Platform Technologies

Microsoft Azure

Page 5: Breaking into Bots

Chat bots

Bots / Chat bots are

conversational

interfaces

They have a human-like

online presence

A bot resides in a

messaging application as

a contact

Page 6: Breaking into Bots
Page 7: Breaking into Bots

The StoryMHacks

@Saelia

Page 8: Breaking into Bots

@Saelia

Page 9: Breaking into Bots

The SolutionHackathon Bot

@Saelia

Page 10: Breaking into Bots
Page 11: Breaking into Bots

http://portal.azure.com

@Saelia

Page 12: Breaking into Bots
Page 13: Breaking into Bots
Page 14: Breaking into Bots

1. Find your endpoint

URL on Azure

2. Register Your Bot

3. Save App ID and

App Password

@Saelia

Page 15: Breaking into Bots

s /api/messages

Page 16: Breaking into Bots
Page 17: Breaking into Bots

Web App Settings:

2. MICROSOFT_APP_PASSWORD

Page 18: Breaking into Bots

Let’s get coding!#BotFramework

@Saelia

Page 19: Breaking into Bots

@Saelia

Page 20: Breaking into Bots

var restify = require('restify');

var builder = require('botbuilder');

//=========================================================

// Bot Setup

//=========================================================

// Setup Restify Server

var server = restify.createServer();

server.listen(process.env.port || process.env.PORT || 3978, function () {

console.log('%s listening to %s', server.name, server.url);

});

// Create chat bot

var connector = new builder.ChatConnector({

appId: <Your App ID>

appPassword: <Your App Secret>

});

var bot = new builder.UniversalBot(connector);

server.post('/api/messages', connector.listen());

Page 21: Breaking into Bots
Page 22: Breaking into Bots

bot.dialog('/', function (session) {

session.send("Hello World");

});

Page 23: Breaking into Bots

The IntentDialog class lets you listen for the user to say a specific keyword or phrase.

bot.dialog('/study', new builder.IntentDialog()

.matches(/^ready/i, [

function (session) {

session.send(quiz.Terms[index])

}])

.matches(/^flip/i, [

function(session) {

session. send(quiz.Def[index])

}]

)

…...........

);

Page 24: Breaking into Bots

Session object is passed to your dialog handlers any time your bot receives a message from the user.

The session object is the primary mechanism used to manage messages received from and sent to the user.

bot.dialog('/', function (session) {

session.send("Hello! Welcome to the MHacks Quiz Bot. Would you like to study today?")

session.beginDialog('/user');

});

@Saelia

Page 25: Breaking into Bots

bot.dialog('/subject', [

function (session) {

setTimeout(function(){

builder.Prompts.text(session, "What study set would you like today?" + quiz.Sets);

}, 2000)

},

function (session, results) {

quiz.GetTerms(results.response);

session.send("Ok! I got your flashcards! Send 'ready' to begin. Send 'flip' for definition. Send 'next'

for the next card. Send 'exit' when you are done")

session.beginDialog('/study')

}]

);

Page 26: Breaking into Bots

Different return types of prompts available:

builder.Prompts.text(session, "What's your name?");

builder.Prompts.number(session, "How many do you want?");

builder.Prompts.time(session, "When is your appointment?");

builder.Prompts.choice(session, "Which color?", "red|green|blue");

Page 27: Breaking into Bots

bot.dialog('/subject', [

function (session) {

setTimeout(function(){

builder.Prompts.text(session, "What study set would you like today?" + quiz.Sets);

}, 2000)

},

function (session, results) {

quiz.GetTerms(results.response);

session.send("Ok! I got your flashcards! Send 'ready' to begin. Send 'flip' for definition. Send 'next'

for the next card. Send 'exit' when you are done")

session.beginDialog('/study')

}]

);

Page 28: Breaking into Bots

@Saelia

Page 29: Breaking into Bots

Smarter Not Harder!Using LUIS

@Saelia

Page 30: Breaking into Bots

https://www.luis.ai/

Microsoft Cognitive Services

@Saelia

Page 31: Breaking into Bots

Types of

Bots

Page 32: Breaking into Bots

Rule-Based Bots

AI-Based Bots (uses NLP)

Page 33: Breaking into Bots
Page 34: Breaking into Bots
Page 35: Breaking into Bots

{“entities”: [

{“entity”: “flight_delays”,“type”: “Topic”

}],“intents”: [

{“intent”: “FindNews”,“score”: 0.99853384

},{

“intent”: “None”,“score”: 0.07289317

},{

“intent”: “ReadNews”,“score”: 0.0167122427

},{

“intent”: “ShareNews”,“score”: 1.0919299E-06

}]

}

Page 36: Breaking into Bots

I want to use Microsoft technology to hack and win a Surface Pro 4

sponsor action prize

@Saelia

Page 37: Breaking into Bots
Page 38: Breaking into Bots

Demo Time

@Saelia

Page 39: Breaking into Bots

Sarah Sexton

Technical EvangelistUS DX Audience | Microsoft, Chicago@Saelia

• Steps: http://aka.ms/MHacksChatBot

• Demo: MicrosoftCareerBot.azurewebsites.net

• GitHub.com/jennifermarsman/MicrosoftCareerBot

• Slides: http://aka.ms/BreakingIntoBots

• Docs: http://dev.botframework.com

Page 40: Breaking into Bots