How To Troubleshoot Collaboration Apps for the Modern Connected Worker
Microsoft Bot Framework (Node.js Edition)
1. Microsoft Bot Framework
Node.js Edition
Jens Siebert (@jens_siebert)
WebMontag Kassel, 29. Januar 2018
https://www.slideshare.net/JensSiebert1
2. Chatbots
A chatbot is an application, often available via messaging platforms and
using some form of intelligence, that interacts with a user via a
conversational user interface (CUI).
(Joe Mayo, Programming the Microsoft Bot Framework)
7. Warum sollte ich mich damit beschäftigen?
[…] as messaging apps have grown to dominate both phones and
workplaces, we see conversations with other humans being
supplemented by intelligent chatbots. As these platforms improve, they
will learn to understand the context and intent of conversations,
making interactions more lifelike and therefore more compelling.
The explosion of interest in the marketplace and mainstream media
leads to a corresponding rise in developer interest […]
(ThoughtWorks Technology Radar, Volume 16)
8. Warum sollte ich mich damit beschäftigen?
http://www.businessinsider.de/the-messaging-app-report-2015-11
9. Warum sollte ich mich damit beschäftigen?
https://www.twilio.com/learn/commerce-communications/how-consumers-use-messaging
10. Warum sollte ich mich damit beschäftigen?
https://www.twilio.com/learn/commerce-communications/how-consumers-use-messaging
11. Warum sollte ich mich damit beschäftigen?
https://www.gartner.com/smarterwithgartner/top-trends-in-the-gartner-hype-cycle-for-emerging-technologies-2017/
13. Vorteile und Nachteile
• Konversation: CUIs bieten, durch Nutzung geschriebener oder gesprochener Sprache,
einen natürlicheren Zugang zu Informationen.
• Kontext: Es finden keine Kontextwechsel (z.B. unterschiedliche Bedienparadigmen bei
mobilen Apps) statt.
• Bereitstellung: Die Bereitstellung eines Chatbots ist für den Anwender transparent. Keine
Installation, keine Updates, immer aktuell.
• Geräte-unabhängig: Die Interaktion mit dem Chatbot kann mit allen Geräten erfolgen,
die von einer Messaging-Plattform unterstützt werden.
• Plattform-unabhängig: Die Interaktion mit dem Chatbot kann mit allen Plattformen
erfolgen, die von einer Messaging-Plattform unterstützt werden.
• Notwendigkeit: Es gibt bereits eine erfolgreiche mobile App für einen Service. Welche
Vorteile bringt ein zusätzlicher Chatbot?
• Angemessenheit: Ist ein CUI die angemessene Benutzerschnittstelle für einen Service?
• Kritikalität: Bietet ein Chatbot die richtige Form der Interaktion für einen Service?
14. Bot Builder SDK
Das Microsoft Bot Framework
Bot Builder
.NET
Bot Builder
Node.js
Bot
Connector
Channels
Azure Bot Service
Chatbot
(ASP.NET/Node.js)
Backend
Services
AI Services
(LUIS)
15. Das Microsoft Bot Framework
• Bot Connector Client
• Messages/Activities
• Dialog-Management
• State-Management
• GUI-Elemente
• Anbindung an AI-Services (LUIS)
16. Das Microsoft Bot Framework
Bot
Connector
Channel Chatbot
Backend
Service
AI Service
Activity
Route
Message
Query
Query
Response
Response
Response
Route
Response
27. Der Dialog-Stack
bot.dialog("mainMenu", [
function(session) {
// Auswahl „Suchen“, „Registrieren“, „Profil erstellen“
},
function(session, result) {
if (result.response.entity.toLowerCase().startsWith("search")) {
session.beginDialog("search");
}
else if (result.response.entity.toLowerCase().startsWith("create")) {
session.beginDialog("create");
}
else {
session.send("Search and Profile Creation are currently the only things that you can do");
session.replaceDialog("mainMenu");
}
},
function(session, result) {
session.replaceDialog("mainMenu");
}
]);
bot.dialog(„create", [
[…]
function(session) {
session.endDialog();
}
]);
Session.beginDialog
Session.cancelDialog
Session.endConversation
Session.endDialog
Session.endDialogWithResult
Session.replaceDialog
28. Dialog-Actions
Enter first name
Enter last name
Enter e-mail
Enter company
name
restart()
cancel()
cancel()
cancel()
cancel()
help()
quit()
status()
?
29. Dialog-Actions
bot.dialog("create", [
function(session, result) {
session.send("Create a new profile...");
builder.Prompts.text(session, "Please enter your first name.");
},
[…]
])
.beginDialogAction("profileCreationHelp", "profileCreationHelp", {
matches: /^help$/i
})
.cancelAction("cancelAction", "Canceled Profile Creation.", {
matches: /^cancel$/i,
confirmPrompt: "This will cancel the Profile Creation. Are you sure?"
})
.reloadAction("reloadAction", "Restarting Profile Creation.", {
matches: /^restart$/i
})
.endConversationAction("endConversation", "Leaving Conversation…", {
matches: /^quit$/i,
confirmPrompt: "This will end the current Conversation. Are you sure?"
});
34. Natural Language Processing (NLP)
bot.dialog("search", [
function(session, result) {
const options = [
"All Events",
"Upcoming Events",
"Past Events"
];
builder.Prompts.choice(
session,
"Which Events would you like too see?",
options,
{
retryPrompt: "Please select a valid option!",
listStyle: builder.ListStyle.button
}
);
},
[…]
if (result.response.entity.toLowerCase().startsWith("upcoming")) {
[…]
}
else if (result.response.entity.toLowerCase().startsWith("past")) {
[…]
}
else {
[…]
}
[…]
- „Kommando-artig“
- Keine natürliche Sprache
35. Language Understanding Intelligent Service
https://www.luis.ai
Utterances
„Show me a list of upcoming events“
Intents
„Search“
Entities
SearchOption.All
SearchOption.Upcoming
SearchOption.Past
38. LUIS Modell im Code einbinden
const LuisHost = "westus.api.cognitive.microsoft.com";
const ModelId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
const KeyId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const LuisModelUrl = `https://${LuisHost}/luis/v2.0/apps/${ModelId}?subscription-key=${KeyId}`;
let recognizer = new builder.LuisRecognizer(LuisModelUrl);
bot.dialog("search", new builder.IntentDialog({ recognizers: [recognizer] })
.onBegin(function(session) {
session.send("Welcome to LUIS event search. Here are some examples that I can recognize: "Show all events"…");
})
.matches("Search", [
function(session, result) {
let entity = builder.EntityRecognizer.findEntity(result.entities, "SearchOption");
if (!entity) {
session.endDialog("Sorry, I did not understand...");
}
else {
let searchOption = entity.resolution.values[0];
[…]
}
},
[…]
]);
44. Weitere Themen
• State Data Management
• Advanced Message Handling
• Channel-specific Functionality
• Localization
• Hand-off to Human
• Cortana Skills