SlideShare a Scribd company logo
Bot-Tender:
A Chat Bot Walks into a Bar
Eran Stiller
Chief Technology Officer, CodeValue
erans@codevalue.net
@eranstiller
https://stiller.blog
https://codevalue.net
2
4
5
Agenda
6
▪ Azure Bot Service
▪ Bot Builder SDK
▪ Activities
▪ Conversations
▪ Dialogs & Prompts
▪ State
▪ Microsoft Cognitive Services
▪ Image Search
▪ Language Understanding (LUIS)
▪ Deployment & Channel Integration
About Eran
Eran Stiller
▪ @eranstiller
▪ CTO & Founder at CodeValue
▪ Software architect, consultant and instructor
▪ Microsoft Regional Director & Azure MVP
▪ Founder of Azure Israel Meetup
7
About CodeValue
▪ Awesome software company!
▪ Technology experts
▪ High quality software development solutions
Cloud Computing
Advanced Mobile
Technologies
UI/UX & Graphic
Design
Cross Platform
Development
Advanced Web
Technologies
ALM & DevOps Software Architecture
IOT & Embedded
Software
Training & Mentoring
Development
Management &
Methodology
8
Introduction to Chat Bots
9
▪ Natural Language User Interface (NLUI)
▪ Another form of User Experience (UX)
▪ Various platforms
▪ Web
▪ Mobile
▪ Social Networks
▪ Messaging Apps
▪ Personal Assistants
▪ Text and/or Speech
Introducing Beer Bot
10
▪ Your friendly bartender bot
▪ Or Bot-Tender
▪ Beer-Bot can:
▪ Give you a random beer
▪ Recommend a beer
▪ Order you a beer with a chaser and side dish
Architecture
12
Beer Bot Beer API Beer DB
User
https://openbeerdb.com/
Beer Bot – Simplified Conversation View
13
Main Menu
Recommend
Beer
By
Category
By Origin
By
Name
Order Beer Help
Beer Chaser Side Dish
Entrance
Random Beer
Azure Bot Service
14
Azure Bot Service
Bot web service
Your bot code
Entity
Extraction
Speech
Vision/Face
Natural
Language
Translation
+ Microsoft Cognitive Services
Search
Emotion
Knowledge
API
…
Message input <> output
Bot Service
Conversation Canvas/Channels
………
Other services, APIs,
Databases, Azure Machine
Learning, Azure Search,
etc…
Bot Builder SDK
Web Chat
Direct Line…
Email
Facebook
GroupMe
Kik
Skype
Slack
Telegram
Twilio (SMS)
Bot Builder SDK
Your bot code goes here
15
Building Bots
▪ The hard way – DIY
▪ Implement a REST API
▪ The easier way – Bot Builder SDK
▪ C#
▪ JavaScript / TypeScript
▪ Python
▪ Java (preview)
16
Bot Builder SDK
17
Basic Concepts
▪ Activities
▪ Communication events exchanged between users and your bot
▪ Message activities contain actual messages
▪ Conversations
▪ A logical thread/session
▪ Can contain more than one user
▪ Channels
▪ A bot integration, where the user interacts with the bot
▪ Users
▪ A specific, identified user
18
Implementing Bots
19
[Route("api/messages")]
[ApiController]
public class BotController : ControllerBase
{
private readonly IBotFrameworkHttpAdapter _adapter;
private readonly IBot _bot;
public BotController(IBotFrameworkHttpAdapter adapter, IBot bot)
{
_adapter = adapter;
_bot = bot;
}
[HttpPost, HttpGet]
public async Task PostAsync(CancellationToken cancellationToken)
{
// Delegate the processing of the HTTP POST to the adapter.
// The adapter will invoke the bot.
await _adapter.ProcessAsync(Request, Response, _bot, cancellationToken);
}
}
Implementing Bots
20
public class BeerBot : ActivityHandler // IBot
{
public BeerBot(/* Dependencies */)
{
// ...
}
protected override async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken)
{
// ...
}
}
Implementing Bots
21
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers().AddNewtonsoftJson();
services.AddSingleton<IBotFrameworkHttpAdapter, BeerBotHttpAdapter>();
services.AddTransient<IBot, Bots.BeerBot>();
// ...
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// ...
}
}
Bot Framework Emulator
22
Demo
Basic Bot
23
Dialogs
▪ Dialogs are for bots like screens are for apps
▪ Dialogs are serialized into a stack
▪ The dialog state is stored as part of the conversation state
24
Main
Recommend
Beer
Order Beer
Prompts
▪ Prompts are abstraction for easily acquiring user input
▪ AttachmentPrompt
▪ ChoicePrompt
▪ ConfirmPrompt
▪ DateTimePrompt
▪ NumberPrompt
▪ TextPrompt
▪ All prompts inherit Prompt<T>
▪ Which is a dialog
▪ You can write your own
25
Implementing Dialogs
26
public class MainDialog : ComponentDialog
{
public MainDialog() : base(nameof(MainDialog))
{
AddDialog(new TextPrompt(nameof(TextPrompt)));
AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
AddDialog(new WaterfallDialog(nameof(MainDialog), new WaterfallStep[]
{
IntroStepAsync,
ShowMenuAsync,
ActStepAsync,
FinalStepAsync,
}));
InitialDialogId = nameof(MainDialog);
}
private Task<DialogTurnResult> IntroStepAsync(WaterfallStepContext stepContext,
CancellationToken cancellationToken)
{
27
AddDialog(new WaterfallDialog(nameof(MainDialog), new WaterfallStep[]
{
IntroStepAsync,
ShowMenuAsync,
ActStepAsync,
FinalStepAsync,
}));
InitialDialogId = nameof(MainDialog);
}
private Task<DialogTurnResult> IntroStepAsync(WaterfallStepContext stepContext,
CancellationToken cancellationToken)
{
var message = stepContext.Options?.ToString() ??
"Welcome to your friendly neighborhood bot-tender! How can I help?";
var promptMessage = MessageFactory.Text(message, message, InputHints.ExpectingInput);
return stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = promptMessage },
cancellationToken);
}
// ...
}
Bot State
▪ State can be managed at multiple levels
▪ Conversation State
▪ Including Dialog State
▪ User State
▪ State is persisted by a state storage service
▪ Some are provided out-of-the-box
▪ In-memory, file, Azure Blobs, Cosmos DB
▪ Can write your own
▪ State can be used to direct conversation flow
28
Demo
Basic Dialog Flow
29
Composing Dialogs
▪ For a complex scenario, the need for dialog modularity arises
▪ Placing all dialogs in a single Dialog is not recommended
▪ “Dialog Monolith”
▪ Hard to maintain, not reusable
▪ Component Dialogs are the solution
▪ Group related dialogs into components, isolating them from unrelated dialogs
30
Composing Dialogs
31
public class RecommendBeerDialog : ComponentDialog
{
public RecommendBeerDialog(RecommendBeerByCategoryDialog byCategory, RecommendBeerByOriginDialog byOrigin,
RecommendBeerByNameDialog byName) : base(nameof(RecommendBeerDialog))
{
AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt)));
AddDialog(byCategory);
AddDialog(byOrigin);
AddDialog(byName);
AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
{
ShowMenu,
InvokeDialog,
AskForConfirmation,
FinalConfirmation,
SetResult
}));
InitialDialogId = nameof(WaterfallDialog);
}
32
private Task<DialogTurnResult> ShowMenu(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
const string promptMessage = "How would you like me to recommend your beer?";
const string retryPromptMessage = "Not sure I got it. Could you try again?";
var prompt = new PromptOptions
{
Prompt = MessageFactory.Text(promptMessage, promptMessage, InputHints.ExpectingInput),
RetryPrompt = MessageFactory.Text(retryPromptMessage, retryPromptMessage, InputHints.ExpectingInput),
Choices = RecommendationMenu.Choices,
};
return stepContext.PromptAsync(nameof(ChoicePrompt), prompt, cancellationToken);
}
private Task<DialogTurnResult> InvokeDialog(WaterfallStepContext stepContext,
CancellationToken cancellationToken)
{
var choice = (FoundChoice) stepContext.Result;
var dialogId = RecommendationMenu.GetEntryResult(choice.Value);
return stepContext.BeginDialogAsync(dialogId, cancellationToken: cancellationToken);
}
// ...
}
Demo
Beer
Recommendation
Dialog
33
Forms
▪ Sometimes we need the user to input some predefined fields
34
Demo
Beer Order Dialog
35
Rich Cards
36
Card Type Description
Adaptive Card A customizable card that can contain any combination of text, speech, images, buttons,
and input fields.
Animation Card A card that can play animated GIFs or short videos.
Audio Card A card that can play an audio file.
Hero Card A card that typically contains a single large image, one or more buttons, and text.
Thumbnail Card A card that typically contains a single thumbnail image, one or more buttons, and text.
Receipt Card A card that enables a bot to provide a receipt to the user.
Sign-In Card A card that enables a bot to request that a user sign-in.
Video Card A card that can play videos.
▪ Sometimes text is not enough
▪ Can create media rich “cards”
Hero Cards
37
Creating a Card
38
private async Task SendBeerCardAsync(string beerName, ITurnContext turnContext,
CancellationToken cancellationToken)
{
var imageUrl = await _imageSearch.SearchImage($"{beerName} beer");
const string title = "Your Beer";
var activity = MessageFactory.Attachment(
new HeroCard(
title,
beerName,
images: new[] {new CardImage(imageUrl.ToString())}
)
.ToAttachment(), null, title, InputHints.IgnoringInput);
await turnContext.SendActivityAsync(activity, cancellationToken);
const string messageBase = "Glad I could help";
await turnContext.SendActivityAsync($"{messageBase} {Emoji.Beer}", messageBase,
InputHints.IgnoringInput, cancellationToken);
}
Azure Cognitive Services – Image Search
39
internal class CognitiveServicesImageSearch : IImageSearch
{
private readonly HttpClient _httpClient;
public CognitiveServicesImageSearch(IOptions<CognitiveServicesImageSearchOptions> options)
{
_httpClient = new HttpClient { BaseAddress = new Uri(options.Value.EndpointUrl) };
_httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", options.Value.ApiKey);
}
public async Task<Uri> SearchImage(string query)
{
var response = await _httpClient.GetAsync($"?q={query}");
response.EnsureSuccessStatusCode();
var resultString = await response.Content.ReadAsStringAsync();
dynamic result = JsonConvert.DeserializeObject<JObject>(resultString);
var url = (string)result.value[0].contentUrl;
return new Uri(url);
}
}
“Typing” Indicator
▪ Your users expect you to reply quickly
41
“Typing” Indicator
42
“Typing” Indicator
43
Sending a Notification Ad-Hoc
44
var typingActivity = Activity.CreateTypingActivity();
await turnContext.SendActivityAsync(typingActivity, cancellationToken);
await Task.Delay(1500, cancellationToken); // Make it look like we're typing a lot
Sending a Notification Automatically
45
internal class BeerBotHttpAdapter : BotFrameworkHttpAdapter
{
public BeerBotHttpAdapter(IConfiguration configuration, ILogger<BotFrameworkHttpAdapter> logger)
: base(configuration, logger)
{
// ...
Use(new ShowTypingMiddleware(delay: 500, period: 2000)); // These are default values
}
}
Demo
Hero Card &
Typing Notification
46
User State
▪ A bot can store state that is persisted per user across conversations
47
User State
48
public OrderBeerDialog(SearchBeerForOrderDialog searchDialog, UserState userState)
: base(nameof(OrderBeerDialog))
{
_lastOrderAccessor = userState.CreateProperty<BeerOrder>("LastOrder");
// ...
}
private async Task<DialogTurnResult> CheckUsualOrderStep(WaterfallStepContext stepContext,
CancellationToken cancellationToken)
{
var lastOrder = await _lastOrderAccessor.GetAsync(stepContext.Context, cancellationToken: cancellationToken);
// ...
}
Demo
User State
49
Natural Language
50
LUIS
51
LUIS & Bot Framework
52
public MainDialog(RandomBeerDialog randomBeerDialog, OrderBeerDialog orderBeerDialog,
RecommendationConversionDialog recommendationConversionDialog, IRecognizer luisRecognizer)
: base(nameof(MainDialog))
{
_luisRecognizer = luisRecognizer;
// ...
}
private async Task<DialogTurnResult> ShowMenuAsync(WaterfallStepContext stepContext,
CancellationToken cancellationToken)
{
var luisModel = await _luisRecognizer.RecognizeAsync<BeerBotLuisModel>(stepContext.Context, cancellationToken);
var intent = luisModel.TopIntent().intent;
// ...
}
Demo
LUIS Integration
53
Deployment
▪ The Bot is just a REST API
▪ Can be hosted anywhere
▪ Azure App Service is an easy choice
54
Channels
55
Monitoring
56
Demo
Deployment,
Channels &
Monitoring
57
Speech
58
https://windows.gadgethacks.com/how-to/ultimate-guide-using-cortana-voice-commands-windows-10-0163095/
Speech
▪ All operations have a form which accepts a “speak” parameter
59
(stepContext, cancellationToken) => stepContext.PromptAsync(Inputs.Choice, new PromptOptions
{
Prompt = MessageFactory.Text(
"How would you like me to recommend your beer?",
"How would you like me to recommend your beer? By category, by origin, or by name?",
InputHints.ExpectingInput),
RetryPrompt = MessageFactory.Text(
"Not sure I got it. Could you try again?",
"Not sure I got it. By category, by origin, or by name?",
InputHints.ExpectingInput),
Choices = RecommendationMenu.Choices,
}),
SSML
▪ Speech Synthesis Markup Language
60
The rental car you reserved <break strength="medium" /> a mid-size sedan
<break strength="medium" /> will be ready for you to pick up at <break
time="500ms" /> <say-as interpret-as="hms12"> 4:00pm </say-as> today.
For English, press 1.
<voice xml:lang="fr-FR" gender="female"> Pour le français, appuyez sur 2 </voice>
<prosody volume="x-loud"> This is extra loud volume. </prosody>
<audio src=“http://somewhere.com/mymusic.mp3"> Here's today's weather forecast. </audio>
https://msdn.microsoft.com/en-us/library/jj127898.aspx
Demo
Cortana Skill
61
Takeaways
62
▪ Chat bots are another form of UX
▪ Azure Bot Service makes it easier to write your bot
▪ Standard connection to various channels
▪ Focus on your own business logic
▪ Bot Builder SDK is the preferred way for authoring your bot to work with the
Bot Service
▪ LUIS allows easily adding NLP to your bot
▪ Adding speech enhances your bot on supported channels
Takeaways
63
Resources
▪ Slide Deck
▪ https://www.slideshare.net/EranStiller
▪ Sample Code
▪ https://github.com/estiller/beer-bot-v4
▪ Product & Documentation
▪ https://github.com/Microsoft/botbuilder
▪ https://docs.microsoft.com/en-us/azure/bot-service/
▪ https://github.com/BotBuilderCommunity
▪ More Samples
▪ https://github.com/Microsoft/BotBuilder-Samples
64
Eran Stiller
Chief Technology Officer
erans@codevalue.net
@eranstiller
https://stiller.blog
https://codevalue.net

More Related Content

Similar to Bot-Tender: A Chat Bot Walks into a Bar (2020)

Build a great conversationalist using Azure Bot Service 2018
Build a great conversationalist using Azure Bot Service 2018Build a great conversationalist using Azure Bot Service 2018
Build a great conversationalist using Azure Bot Service 2018
Radoslav Gatev
 
Bot-Tender: A Chat Bot Walks into a Bar - TechBash 2017
Bot-Tender: A Chat Bot Walks into a Bar - TechBash 2017Bot-Tender: A Chat Bot Walks into a Bar - TechBash 2017
Bot-Tender: A Chat Bot Walks into a Bar - TechBash 2017
Eran Stiller
 
Bot design AIsatPN 2018
Bot design AIsatPN 2018Bot design AIsatPN 2018
Bot design AIsatPN 2018
Jessica Tibaldi
 
An introduction to Microsoft Bot Framework
An introduction to Microsoft Bot FrameworkAn introduction to Microsoft Bot Framework
An introduction to Microsoft Bot Framework
Taswar Bhatti
 
How to Build a Serverless Chatbot for $0?
How to Build a Serverless Chatbot for $0?How to Build a Serverless Chatbot for $0?
How to Build a Serverless Chatbot for $0?
Mobile Monday Srbija
 
Microsoft Bot Framework (Node.js Edition)
Microsoft Bot Framework (Node.js Edition)Microsoft Bot Framework (Node.js Edition)
Microsoft Bot Framework (Node.js Edition)
Jens Siebert
 
Chatbots - A CMD for Humans (Ort Braude 2018)
Chatbots - A CMD for Humans (Ort Braude 2018)Chatbots - A CMD for Humans (Ort Braude 2018)
Chatbots - A CMD for Humans (Ort Braude 2018)
Moaid Hathot
 
Chatbots - A CMD for Humans (Global Azure Bootcamp 2018, Tel-Aviv, Israel)
Chatbots - A CMD for Humans (Global Azure Bootcamp 2018, Tel-Aviv, Israel)Chatbots - A CMD for Humans (Global Azure Bootcamp 2018, Tel-Aviv, Israel)
Chatbots - A CMD for Humans (Global Azure Bootcamp 2018, Tel-Aviv, Israel)
Moaid Hathot
 
Création facile de chatbots - Créez votre chatbot en 20 minutes avec une plat...
Création facile de chatbots - Créez votre chatbot en 20 minutes avec une plat...Création facile de chatbots - Créez votre chatbot en 20 minutes avec une plat...
Création facile de chatbots - Créez votre chatbot en 20 minutes avec une plat...
Jordi Cabot
 
#OSSPARIS19 - Création facile de chatbots - Créez votre chatbot en 20 minutes...
#OSSPARIS19 - Création facile de chatbots - Créez votre chatbot en 20 minutes...#OSSPARIS19 - Création facile de chatbots - Créez votre chatbot en 20 minutes...
#OSSPARIS19 - Création facile de chatbots - Créez votre chatbot en 20 minutes...
Paris Open Source Summit
 
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
ITCamp
 
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp
 
Bot-Tender: A Chat Bot Walks into a Bar (Microsoft Tech Days Sweden 2018)
Bot-Tender: A Chat Bot Walks into a Bar (Microsoft Tech Days Sweden 2018)Bot-Tender: A Chat Bot Walks into a Bar (Microsoft Tech Days Sweden 2018)
Bot-Tender: A Chat Bot Walks into a Bar (Microsoft Tech Days Sweden 2018)
Eran Stiller
 
Build intelligent chatbot with bot framework
Build intelligent chatbot with bot frameworkBuild intelligent chatbot with bot framework
Build intelligent chatbot with bot framework
Puja Pramudya
 
Basic html5 and javascript
Basic html5 and javascriptBasic html5 and javascript
Basic html5 and javascriptwendy017
 
Programming the Microsoft Bot Framework
Programming the Microsoft Bot FrameworkProgramming the Microsoft Bot Framework
Programming the Microsoft Bot Framework
Stefano Tempesta
 
201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio201507_NeoHsu_Portfolio
201507_NeoHsu_PortfolioNeo Hsu
 
Dynamics 365 Saturday Amsterdam 02/2018 - Dynamics 365 and chatbots
Dynamics 365 Saturday Amsterdam 02/2018 - Dynamics 365 and chatbotsDynamics 365 Saturday Amsterdam 02/2018 - Dynamics 365 and chatbots
Dynamics 365 Saturday Amsterdam 02/2018 - Dynamics 365 and chatbots
Joris Poelmans
 
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
Sébastien Levert
 
Having fun with Microsoft Bot Framework and Azure Cognitive Services
Having fun with Microsoft Bot Framework and Azure Cognitive ServicesHaving fun with Microsoft Bot Framework and Azure Cognitive Services
Having fun with Microsoft Bot Framework and Azure Cognitive Services
Anton Danylov
 

Similar to Bot-Tender: A Chat Bot Walks into a Bar (2020) (20)

Build a great conversationalist using Azure Bot Service 2018
Build a great conversationalist using Azure Bot Service 2018Build a great conversationalist using Azure Bot Service 2018
Build a great conversationalist using Azure Bot Service 2018
 
Bot-Tender: A Chat Bot Walks into a Bar - TechBash 2017
Bot-Tender: A Chat Bot Walks into a Bar - TechBash 2017Bot-Tender: A Chat Bot Walks into a Bar - TechBash 2017
Bot-Tender: A Chat Bot Walks into a Bar - TechBash 2017
 
Bot design AIsatPN 2018
Bot design AIsatPN 2018Bot design AIsatPN 2018
Bot design AIsatPN 2018
 
An introduction to Microsoft Bot Framework
An introduction to Microsoft Bot FrameworkAn introduction to Microsoft Bot Framework
An introduction to Microsoft Bot Framework
 
How to Build a Serverless Chatbot for $0?
How to Build a Serverless Chatbot for $0?How to Build a Serverless Chatbot for $0?
How to Build a Serverless Chatbot for $0?
 
Microsoft Bot Framework (Node.js Edition)
Microsoft Bot Framework (Node.js Edition)Microsoft Bot Framework (Node.js Edition)
Microsoft Bot Framework (Node.js Edition)
 
Chatbots - A CMD for Humans (Ort Braude 2018)
Chatbots - A CMD for Humans (Ort Braude 2018)Chatbots - A CMD for Humans (Ort Braude 2018)
Chatbots - A CMD for Humans (Ort Braude 2018)
 
Chatbots - A CMD for Humans (Global Azure Bootcamp 2018, Tel-Aviv, Israel)
Chatbots - A CMD for Humans (Global Azure Bootcamp 2018, Tel-Aviv, Israel)Chatbots - A CMD for Humans (Global Azure Bootcamp 2018, Tel-Aviv, Israel)
Chatbots - A CMD for Humans (Global Azure Bootcamp 2018, Tel-Aviv, Israel)
 
Création facile de chatbots - Créez votre chatbot en 20 minutes avec une plat...
Création facile de chatbots - Créez votre chatbot en 20 minutes avec une plat...Création facile de chatbots - Créez votre chatbot en 20 minutes avec une plat...
Création facile de chatbots - Créez votre chatbot en 20 minutes avec une plat...
 
#OSSPARIS19 - Création facile de chatbots - Créez votre chatbot en 20 minutes...
#OSSPARIS19 - Création facile de chatbots - Créez votre chatbot en 20 minutes...#OSSPARIS19 - Création facile de chatbots - Créez votre chatbot en 20 minutes...
#OSSPARIS19 - Création facile de chatbots - Créez votre chatbot en 20 minutes...
 
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
 
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
 
Bot-Tender: A Chat Bot Walks into a Bar (Microsoft Tech Days Sweden 2018)
Bot-Tender: A Chat Bot Walks into a Bar (Microsoft Tech Days Sweden 2018)Bot-Tender: A Chat Bot Walks into a Bar (Microsoft Tech Days Sweden 2018)
Bot-Tender: A Chat Bot Walks into a Bar (Microsoft Tech Days Sweden 2018)
 
Build intelligent chatbot with bot framework
Build intelligent chatbot with bot frameworkBuild intelligent chatbot with bot framework
Build intelligent chatbot with bot framework
 
Basic html5 and javascript
Basic html5 and javascriptBasic html5 and javascript
Basic html5 and javascript
 
Programming the Microsoft Bot Framework
Programming the Microsoft Bot FrameworkProgramming the Microsoft Bot Framework
Programming the Microsoft Bot Framework
 
201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio
 
Dynamics 365 Saturday Amsterdam 02/2018 - Dynamics 365 and chatbots
Dynamics 365 Saturday Amsterdam 02/2018 - Dynamics 365 and chatbotsDynamics 365 Saturday Amsterdam 02/2018 - Dynamics 365 and chatbots
Dynamics 365 Saturday Amsterdam 02/2018 - Dynamics 365 and chatbots
 
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
 
Having fun with Microsoft Bot Framework and Azure Cognitive Services
Having fun with Microsoft Bot Framework and Azure Cognitive ServicesHaving fun with Microsoft Bot Framework and Azure Cognitive Services
Having fun with Microsoft Bot Framework and Azure Cognitive Services
 

More from Eran Stiller

Architecting at Scale with the Advice Process
Architecting at Scale with the Advice ProcessArchitecting at Scale with the Advice Process
Architecting at Scale with the Advice Process
Eran Stiller
 
Application Evolution Strategy
Application Evolution StrategyApplication Evolution Strategy
Application Evolution Strategy
Eran Stiller
 
Developing and Deploying Microservices with Project Tye
Developing and Deploying Microservices with Project TyeDeveloping and Deploying Microservices with Project Tye
Developing and Deploying Microservices with Project Tye
Eran Stiller
 
API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020
Eran Stiller
 
Why Don’t You Understand Me? Build Intelligence into Your Apps
Why Don’t You Understand Me? Build Intelligence into Your AppsWhy Don’t You Understand Me? Build Intelligence into Your Apps
Why Don’t You Understand Me? Build Intelligence into Your Apps
Eran Stiller
 
Modern Microservices Architecture with Docker
Modern Microservices Architecture with DockerModern Microservices Architecture with Docker
Modern Microservices Architecture with Docker
Eran Stiller
 
Windows Containers - Microsoft Ignite The Tour
Windows Containers - Microsoft Ignite The TourWindows Containers - Microsoft Ignite The Tour
Windows Containers - Microsoft Ignite The Tour
Eran Stiller
 
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
Eran Stiller
 
Bot Framework - Microsoft Ignite The Tour
Bot Framework - Microsoft Ignite The TourBot Framework - Microsoft Ignite The Tour
Bot Framework - Microsoft Ignite The Tour
Eran Stiller
 
It's a Serverless World
It's a Serverless WorldIt's a Serverless World
It's a Serverless World
Eran Stiller
 
Keynote - From Monolith to Microservices - Lessons Learned in the Real World
Keynote - From Monolith to Microservices - Lessons Learned in the Real WorldKeynote - From Monolith to Microservices - Lessons Learned in the Real World
Keynote - From Monolith to Microservices - Lessons Learned in the Real World
Eran Stiller
 
Architecting a Serverless IoT System in the Cloud
Architecting a Serverless IoT System in the CloudArchitecting a Serverless IoT System in the Cloud
Architecting a Serverless IoT System in the Cloud
Eran Stiller
 
6 Lessons I Learned on my Journey from Monolith to Microservices
6 Lessons I Learned on my Journey from Monolith to Microservices6 Lessons I Learned on my Journey from Monolith to Microservices
6 Lessons I Learned on my Journey from Monolith to Microservices
Eran Stiller
 
IoT in Action Keynote - CodeValue
IoT in Action Keynote - CodeValueIoT in Action Keynote - CodeValue
IoT in Action Keynote - CodeValue
Eran Stiller
 
Net Conf Israel - Intro & Building Cloud Native Apps with .NET Core 3.0 and K...
Net Conf Israel - Intro & Building Cloud Native Apps with .NET Core 3.0 and K...Net Conf Israel - Intro & Building Cloud Native Apps with .NET Core 3.0 and K...
Net Conf Israel - Intro & Building Cloud Native Apps with .NET Core 3.0 and K...
Eran Stiller
 
Create Your Own Serverless PKI with .NET & Azure Key Vault
Create Your Own Serverless PKI with .NET & Azure Key VaultCreate Your Own Serverless PKI with .NET & Azure Key Vault
Create Your Own Serverless PKI with .NET & Azure Key Vault
Eran Stiller
 
Cloud Native Development on Azure
Cloud Native Development on AzureCloud Native Development on Azure
Cloud Native Development on Azure
Eran Stiller
 
Today, the Cloud Is Your Advantage
Today, the Cloud Is Your AdvantageToday, the Cloud Is Your Advantage
Today, the Cloud Is Your Advantage
Eran Stiller
 
Build 2019 Recap
Build 2019 RecapBuild 2019 Recap
Build 2019 Recap
Eran Stiller
 
To Microservice or Not to Microservice?
To Microservice or Not to Microservice?To Microservice or Not to Microservice?
To Microservice or Not to Microservice?
Eran Stiller
 

More from Eran Stiller (20)

Architecting at Scale with the Advice Process
Architecting at Scale with the Advice ProcessArchitecting at Scale with the Advice Process
Architecting at Scale with the Advice Process
 
Application Evolution Strategy
Application Evolution StrategyApplication Evolution Strategy
Application Evolution Strategy
 
Developing and Deploying Microservices with Project Tye
Developing and Deploying Microservices with Project TyeDeveloping and Deploying Microservices with Project Tye
Developing and Deploying Microservices with Project Tye
 
API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020
 
Why Don’t You Understand Me? Build Intelligence into Your Apps
Why Don’t You Understand Me? Build Intelligence into Your AppsWhy Don’t You Understand Me? Build Intelligence into Your Apps
Why Don’t You Understand Me? Build Intelligence into Your Apps
 
Modern Microservices Architecture with Docker
Modern Microservices Architecture with DockerModern Microservices Architecture with Docker
Modern Microservices Architecture with Docker
 
Windows Containers - Microsoft Ignite The Tour
Windows Containers - Microsoft Ignite The TourWindows Containers - Microsoft Ignite The Tour
Windows Containers - Microsoft Ignite The Tour
 
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
 
Bot Framework - Microsoft Ignite The Tour
Bot Framework - Microsoft Ignite The TourBot Framework - Microsoft Ignite The Tour
Bot Framework - Microsoft Ignite The Tour
 
It's a Serverless World
It's a Serverless WorldIt's a Serverless World
It's a Serverless World
 
Keynote - From Monolith to Microservices - Lessons Learned in the Real World
Keynote - From Monolith to Microservices - Lessons Learned in the Real WorldKeynote - From Monolith to Microservices - Lessons Learned in the Real World
Keynote - From Monolith to Microservices - Lessons Learned in the Real World
 
Architecting a Serverless IoT System in the Cloud
Architecting a Serverless IoT System in the CloudArchitecting a Serverless IoT System in the Cloud
Architecting a Serverless IoT System in the Cloud
 
6 Lessons I Learned on my Journey from Monolith to Microservices
6 Lessons I Learned on my Journey from Monolith to Microservices6 Lessons I Learned on my Journey from Monolith to Microservices
6 Lessons I Learned on my Journey from Monolith to Microservices
 
IoT in Action Keynote - CodeValue
IoT in Action Keynote - CodeValueIoT in Action Keynote - CodeValue
IoT in Action Keynote - CodeValue
 
Net Conf Israel - Intro & Building Cloud Native Apps with .NET Core 3.0 and K...
Net Conf Israel - Intro & Building Cloud Native Apps with .NET Core 3.0 and K...Net Conf Israel - Intro & Building Cloud Native Apps with .NET Core 3.0 and K...
Net Conf Israel - Intro & Building Cloud Native Apps with .NET Core 3.0 and K...
 
Create Your Own Serverless PKI with .NET & Azure Key Vault
Create Your Own Serverless PKI with .NET & Azure Key VaultCreate Your Own Serverless PKI with .NET & Azure Key Vault
Create Your Own Serverless PKI with .NET & Azure Key Vault
 
Cloud Native Development on Azure
Cloud Native Development on AzureCloud Native Development on Azure
Cloud Native Development on Azure
 
Today, the Cloud Is Your Advantage
Today, the Cloud Is Your AdvantageToday, the Cloud Is Your Advantage
Today, the Cloud Is Your Advantage
 
Build 2019 Recap
Build 2019 RecapBuild 2019 Recap
Build 2019 Recap
 
To Microservice or Not to Microservice?
To Microservice or Not to Microservice?To Microservice or Not to Microservice?
To Microservice or Not to Microservice?
 

Recently uploaded

top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 

Recently uploaded (20)

top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 

Bot-Tender: A Chat Bot Walks into a Bar (2020)

  • 1. Bot-Tender: A Chat Bot Walks into a Bar Eran Stiller Chief Technology Officer, CodeValue erans@codevalue.net @eranstiller https://stiller.blog https://codevalue.net
  • 2. 2
  • 3. 4
  • 4. 5
  • 5. Agenda 6 ▪ Azure Bot Service ▪ Bot Builder SDK ▪ Activities ▪ Conversations ▪ Dialogs & Prompts ▪ State ▪ Microsoft Cognitive Services ▪ Image Search ▪ Language Understanding (LUIS) ▪ Deployment & Channel Integration
  • 6. About Eran Eran Stiller ▪ @eranstiller ▪ CTO & Founder at CodeValue ▪ Software architect, consultant and instructor ▪ Microsoft Regional Director & Azure MVP ▪ Founder of Azure Israel Meetup 7
  • 7. About CodeValue ▪ Awesome software company! ▪ Technology experts ▪ High quality software development solutions Cloud Computing Advanced Mobile Technologies UI/UX & Graphic Design Cross Platform Development Advanced Web Technologies ALM & DevOps Software Architecture IOT & Embedded Software Training & Mentoring Development Management & Methodology 8
  • 8. Introduction to Chat Bots 9 ▪ Natural Language User Interface (NLUI) ▪ Another form of User Experience (UX) ▪ Various platforms ▪ Web ▪ Mobile ▪ Social Networks ▪ Messaging Apps ▪ Personal Assistants ▪ Text and/or Speech
  • 9. Introducing Beer Bot 10 ▪ Your friendly bartender bot ▪ Or Bot-Tender ▪ Beer-Bot can: ▪ Give you a random beer ▪ Recommend a beer ▪ Order you a beer with a chaser and side dish
  • 10. Architecture 12 Beer Bot Beer API Beer DB User https://openbeerdb.com/
  • 11. Beer Bot – Simplified Conversation View 13 Main Menu Recommend Beer By Category By Origin By Name Order Beer Help Beer Chaser Side Dish Entrance Random Beer
  • 13. Azure Bot Service Bot web service Your bot code Entity Extraction Speech Vision/Face Natural Language Translation + Microsoft Cognitive Services Search Emotion Knowledge API … Message input <> output Bot Service Conversation Canvas/Channels ……… Other services, APIs, Databases, Azure Machine Learning, Azure Search, etc… Bot Builder SDK Web Chat Direct Line… Email Facebook GroupMe Kik Skype Slack Telegram Twilio (SMS) Bot Builder SDK Your bot code goes here 15
  • 14. Building Bots ▪ The hard way – DIY ▪ Implement a REST API ▪ The easier way – Bot Builder SDK ▪ C# ▪ JavaScript / TypeScript ▪ Python ▪ Java (preview) 16
  • 16. Basic Concepts ▪ Activities ▪ Communication events exchanged between users and your bot ▪ Message activities contain actual messages ▪ Conversations ▪ A logical thread/session ▪ Can contain more than one user ▪ Channels ▪ A bot integration, where the user interacts with the bot ▪ Users ▪ A specific, identified user 18
  • 17. Implementing Bots 19 [Route("api/messages")] [ApiController] public class BotController : ControllerBase { private readonly IBotFrameworkHttpAdapter _adapter; private readonly IBot _bot; public BotController(IBotFrameworkHttpAdapter adapter, IBot bot) { _adapter = adapter; _bot = bot; } [HttpPost, HttpGet] public async Task PostAsync(CancellationToken cancellationToken) { // Delegate the processing of the HTTP POST to the adapter. // The adapter will invoke the bot. await _adapter.ProcessAsync(Request, Response, _bot, cancellationToken); } }
  • 18. Implementing Bots 20 public class BeerBot : ActivityHandler // IBot { public BeerBot(/* Dependencies */) { // ... } protected override async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) { // ... } }
  • 19. Implementing Bots 21 public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddControllers().AddNewtonsoftJson(); services.AddSingleton<IBotFrameworkHttpAdapter, BeerBotHttpAdapter>(); services.AddTransient<IBot, Bots.BeerBot>(); // ... } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { // ... } }
  • 22. Dialogs ▪ Dialogs are for bots like screens are for apps ▪ Dialogs are serialized into a stack ▪ The dialog state is stored as part of the conversation state 24 Main Recommend Beer Order Beer
  • 23. Prompts ▪ Prompts are abstraction for easily acquiring user input ▪ AttachmentPrompt ▪ ChoicePrompt ▪ ConfirmPrompt ▪ DateTimePrompt ▪ NumberPrompt ▪ TextPrompt ▪ All prompts inherit Prompt<T> ▪ Which is a dialog ▪ You can write your own 25
  • 24. Implementing Dialogs 26 public class MainDialog : ComponentDialog { public MainDialog() : base(nameof(MainDialog)) { AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new WaterfallDialog(nameof(MainDialog), new WaterfallStep[] { IntroStepAsync, ShowMenuAsync, ActStepAsync, FinalStepAsync, })); InitialDialogId = nameof(MainDialog); } private Task<DialogTurnResult> IntroStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) {
  • 25. 27 AddDialog(new WaterfallDialog(nameof(MainDialog), new WaterfallStep[] { IntroStepAsync, ShowMenuAsync, ActStepAsync, FinalStepAsync, })); InitialDialogId = nameof(MainDialog); } private Task<DialogTurnResult> IntroStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var message = stepContext.Options?.ToString() ?? "Welcome to your friendly neighborhood bot-tender! How can I help?"; var promptMessage = MessageFactory.Text(message, message, InputHints.ExpectingInput); return stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = promptMessage }, cancellationToken); } // ... }
  • 26. Bot State ▪ State can be managed at multiple levels ▪ Conversation State ▪ Including Dialog State ▪ User State ▪ State is persisted by a state storage service ▪ Some are provided out-of-the-box ▪ In-memory, file, Azure Blobs, Cosmos DB ▪ Can write your own ▪ State can be used to direct conversation flow 28
  • 28. Composing Dialogs ▪ For a complex scenario, the need for dialog modularity arises ▪ Placing all dialogs in a single Dialog is not recommended ▪ “Dialog Monolith” ▪ Hard to maintain, not reusable ▪ Component Dialogs are the solution ▪ Group related dialogs into components, isolating them from unrelated dialogs 30
  • 29. Composing Dialogs 31 public class RecommendBeerDialog : ComponentDialog { public RecommendBeerDialog(RecommendBeerByCategoryDialog byCategory, RecommendBeerByOriginDialog byOrigin, RecommendBeerByNameDialog byName) : base(nameof(RecommendBeerDialog)) { AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))); AddDialog(byCategory); AddDialog(byOrigin); AddDialog(byName); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { ShowMenu, InvokeDialog, AskForConfirmation, FinalConfirmation, SetResult })); InitialDialogId = nameof(WaterfallDialog); }
  • 30. 32 private Task<DialogTurnResult> ShowMenu(WaterfallStepContext stepContext, CancellationToken cancellationToken) { const string promptMessage = "How would you like me to recommend your beer?"; const string retryPromptMessage = "Not sure I got it. Could you try again?"; var prompt = new PromptOptions { Prompt = MessageFactory.Text(promptMessage, promptMessage, InputHints.ExpectingInput), RetryPrompt = MessageFactory.Text(retryPromptMessage, retryPromptMessage, InputHints.ExpectingInput), Choices = RecommendationMenu.Choices, }; return stepContext.PromptAsync(nameof(ChoicePrompt), prompt, cancellationToken); } private Task<DialogTurnResult> InvokeDialog(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var choice = (FoundChoice) stepContext.Result; var dialogId = RecommendationMenu.GetEntryResult(choice.Value); return stepContext.BeginDialogAsync(dialogId, cancellationToken: cancellationToken); } // ... }
  • 32. Forms ▪ Sometimes we need the user to input some predefined fields 34
  • 34. Rich Cards 36 Card Type Description Adaptive Card A customizable card that can contain any combination of text, speech, images, buttons, and input fields. Animation Card A card that can play animated GIFs or short videos. Audio Card A card that can play an audio file. Hero Card A card that typically contains a single large image, one or more buttons, and text. Thumbnail Card A card that typically contains a single thumbnail image, one or more buttons, and text. Receipt Card A card that enables a bot to provide a receipt to the user. Sign-In Card A card that enables a bot to request that a user sign-in. Video Card A card that can play videos. ▪ Sometimes text is not enough ▪ Can create media rich “cards”
  • 36. Creating a Card 38 private async Task SendBeerCardAsync(string beerName, ITurnContext turnContext, CancellationToken cancellationToken) { var imageUrl = await _imageSearch.SearchImage($"{beerName} beer"); const string title = "Your Beer"; var activity = MessageFactory.Attachment( new HeroCard( title, beerName, images: new[] {new CardImage(imageUrl.ToString())} ) .ToAttachment(), null, title, InputHints.IgnoringInput); await turnContext.SendActivityAsync(activity, cancellationToken); const string messageBase = "Glad I could help"; await turnContext.SendActivityAsync($"{messageBase} {Emoji.Beer}", messageBase, InputHints.IgnoringInput, cancellationToken); }
  • 37. Azure Cognitive Services – Image Search 39 internal class CognitiveServicesImageSearch : IImageSearch { private readonly HttpClient _httpClient; public CognitiveServicesImageSearch(IOptions<CognitiveServicesImageSearchOptions> options) { _httpClient = new HttpClient { BaseAddress = new Uri(options.Value.EndpointUrl) }; _httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", options.Value.ApiKey); } public async Task<Uri> SearchImage(string query) { var response = await _httpClient.GetAsync($"?q={query}"); response.EnsureSuccessStatusCode(); var resultString = await response.Content.ReadAsStringAsync(); dynamic result = JsonConvert.DeserializeObject<JObject>(resultString); var url = (string)result.value[0].contentUrl; return new Uri(url); } }
  • 38. “Typing” Indicator ▪ Your users expect you to reply quickly 41
  • 41. Sending a Notification Ad-Hoc 44 var typingActivity = Activity.CreateTypingActivity(); await turnContext.SendActivityAsync(typingActivity, cancellationToken); await Task.Delay(1500, cancellationToken); // Make it look like we're typing a lot
  • 42. Sending a Notification Automatically 45 internal class BeerBotHttpAdapter : BotFrameworkHttpAdapter { public BeerBotHttpAdapter(IConfiguration configuration, ILogger<BotFrameworkHttpAdapter> logger) : base(configuration, logger) { // ... Use(new ShowTypingMiddleware(delay: 500, period: 2000)); // These are default values } }
  • 43. Demo Hero Card & Typing Notification 46
  • 44. User State ▪ A bot can store state that is persisted per user across conversations 47
  • 45. User State 48 public OrderBeerDialog(SearchBeerForOrderDialog searchDialog, UserState userState) : base(nameof(OrderBeerDialog)) { _lastOrderAccessor = userState.CreateProperty<BeerOrder>("LastOrder"); // ... } private async Task<DialogTurnResult> CheckUsualOrderStep(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var lastOrder = await _lastOrderAccessor.GetAsync(stepContext.Context, cancellationToken: cancellationToken); // ... }
  • 49. LUIS & Bot Framework 52 public MainDialog(RandomBeerDialog randomBeerDialog, OrderBeerDialog orderBeerDialog, RecommendationConversionDialog recommendationConversionDialog, IRecognizer luisRecognizer) : base(nameof(MainDialog)) { _luisRecognizer = luisRecognizer; // ... } private async Task<DialogTurnResult> ShowMenuAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var luisModel = await _luisRecognizer.RecognizeAsync<BeerBotLuisModel>(stepContext.Context, cancellationToken); var intent = luisModel.TopIntent().intent; // ... }
  • 51. Deployment ▪ The Bot is just a REST API ▪ Can be hosted anywhere ▪ Azure App Service is an easy choice 54
  • 56. Speech ▪ All operations have a form which accepts a “speak” parameter 59 (stepContext, cancellationToken) => stepContext.PromptAsync(Inputs.Choice, new PromptOptions { Prompt = MessageFactory.Text( "How would you like me to recommend your beer?", "How would you like me to recommend your beer? By category, by origin, or by name?", InputHints.ExpectingInput), RetryPrompt = MessageFactory.Text( "Not sure I got it. Could you try again?", "Not sure I got it. By category, by origin, or by name?", InputHints.ExpectingInput), Choices = RecommendationMenu.Choices, }),
  • 57. SSML ▪ Speech Synthesis Markup Language 60 The rental car you reserved <break strength="medium" /> a mid-size sedan <break strength="medium" /> will be ready for you to pick up at <break time="500ms" /> <say-as interpret-as="hms12"> 4:00pm </say-as> today. For English, press 1. <voice xml:lang="fr-FR" gender="female"> Pour le français, appuyez sur 2 </voice> <prosody volume="x-loud"> This is extra loud volume. </prosody> <audio src=“http://somewhere.com/mymusic.mp3"> Here's today's weather forecast. </audio> https://msdn.microsoft.com/en-us/library/jj127898.aspx
  • 59. Takeaways 62 ▪ Chat bots are another form of UX ▪ Azure Bot Service makes it easier to write your bot ▪ Standard connection to various channels ▪ Focus on your own business logic ▪ Bot Builder SDK is the preferred way for authoring your bot to work with the Bot Service ▪ LUIS allows easily adding NLP to your bot ▪ Adding speech enhances your bot on supported channels
  • 61. Resources ▪ Slide Deck ▪ https://www.slideshare.net/EranStiller ▪ Sample Code ▪ https://github.com/estiller/beer-bot-v4 ▪ Product & Documentation ▪ https://github.com/Microsoft/botbuilder ▪ https://docs.microsoft.com/en-us/azure/bot-service/ ▪ https://github.com/BotBuilderCommunity ▪ More Samples ▪ https://github.com/Microsoft/BotBuilder-Samples 64
  • 62. Eran Stiller Chief Technology Officer erans@codevalue.net @eranstiller https://stiller.blog https://codevalue.net