WEBVTT
00:00:01.750 --> 00:00:03.460
Thanks very much.
00:00:03.460 --> 00:00:04.960
Again, my name is Dan Driscoll.
00:00:04.960 --> 00:00:07.830
I'm a senior developer at
Microsoft Research FUSE Labs and
00:00:07.830 --> 00:00:10.580
I'm gonna tell you all about
the bot framework today.
00:00:10.580 --> 00:00:13.200
I'm guessing most of you saw
the keynote but if you haven't,
00:00:13.200 --> 00:00:15.490
I'll let you know that we've
launched a brand new product for
00:00:15.490 --> 00:00:18.070
a new platform called the Bot
Framework that allows you
00:00:18.070 --> 00:00:20.513
to build your own bots,
connected and intelligent bots.
00:00:20.513 --> 00:00:25.742
I'll go to title slides.
00:00:30.279 --> 00:00:31.700
There we go.
00:00:31.700 --> 00:00:34.240
All right, this session, we have
an hour long session today and
00:00:34.240 --> 00:00:36.100
we're gonna talk all
about how to make a bot.
00:00:37.780 --> 00:00:40.730
We're gonna show you what
it looks like in code.
00:00:40.730 --> 00:00:43.530
We're gonna go all the way from
having no code at all, through
00:00:43.530 --> 00:00:45.580
having a functional bot that's
working in the Bot Framework.
00:00:45.580 --> 00:00:47.540
So we're gonna show
you all those pieces.
00:00:47.540 --> 00:00:49.380
But before we get
started on that,
00:00:49.380 --> 00:00:52.750
before we start really working
on this phrase on the left.
00:00:52.750 --> 00:00:55.750
I want to talk a little bit
about the phrase on the right.
00:00:55.750 --> 00:00:57.200
Not, how do you make a bot?
00:00:57.200 --> 00:00:58.610
But how do you make a bot great?
00:00:58.610 --> 00:01:02.930
I guess the first question
that comes to my mind is,
00:01:02.930 --> 00:01:05.070
when I look at this,
is what actually is a bot?
00:01:06.340 --> 00:01:07.900
I'm sure we can think
of many examples of
00:01:07.900 --> 00:01:10.120
bots that we've seen already,
Cortana,
00:01:10.120 --> 00:01:13.190
Siri, Howdy.ai is a standup bot,
it's really great.
00:01:14.702 --> 00:01:17.160
Simple text-based
adventure game bots,
00:01:17.160 --> 00:01:19.110
there are ton of bots
that are out there.
00:01:19.110 --> 00:01:21.430
And they all have very
different interaction styles.
00:01:21.430 --> 00:01:24.330
And so, when you think about
what you would maybe build on
00:01:24.330 --> 00:01:26.880
the Bot Framework,
you may ask yourself,
00:01:26.880 --> 00:01:28.670
what is the experience
that I want?
00:01:28.670 --> 00:01:31.529
What is going to make a bot that
works really great for users?
00:01:32.680 --> 00:01:34.490
Now, I was talking
with Amir over at Slack
00:01:34.490 --> 00:01:36.620
earlier this week and he had
a really great observation when
00:01:36.620 --> 00:01:39.300
we were talking
about this question.
00:01:39.300 --> 00:01:42.320
He observed that some of
the best bots out there
00:01:42.320 --> 00:01:46.170
make you feel, you as the user,
makes you feel like a director.
00:01:46.170 --> 00:01:47.620
That you have assistants.
00:01:47.620 --> 00:01:49.490
And instead of having to
do the work yourself,
00:01:49.490 --> 00:01:52.330
you can simply point your
assistants to that job, and
00:01:52.330 --> 00:01:54.360
say hey,
please do this thing for me.
00:01:54.360 --> 00:01:56.610
So you can have a bot
that will go and
00:01:56.610 --> 00:01:57.650
look at your server's uptime.
00:01:57.650 --> 00:02:00.125
You don't actually have to log
into the machine or remote or
00:02:00.125 --> 00:02:01.720
do anything and
look at any webpages.
00:02:01.720 --> 00:02:04.660
You just say, hey,
please tell me this information.
00:02:04.660 --> 00:02:06.940
Those bots can also do
things on your behalf.
00:02:06.940 --> 00:02:07.980
Please book a flight.
00:02:07.980 --> 00:02:09.870
Please coordinate with
this other person.
00:02:09.870 --> 00:02:12.870
Please fix the permissions on
the documents that are shared in
00:02:12.870 --> 00:02:14.179
this thread so
that everyone can see them.
00:02:15.310 --> 00:02:16.320
This, I think,
00:02:16.320 --> 00:02:18.860
is a really great way to think
about the very best bots.
00:02:18.860 --> 00:02:20.210
And when you build bots,
00:02:20.210 --> 00:02:23.850
I think it would be great to
think about how you would build
00:02:23.850 --> 00:02:28.020
those kinds of features
into the bots you build.
00:02:28.020 --> 00:02:30.920
This definition, too, I think,
helps us open our minds a lot.
00:02:30.920 --> 00:02:33.260
It helps us open our minds
to what bots can do.
00:02:33.260 --> 00:02:34.910
The kinds of things that
they can accomplish.
00:02:34.910 --> 00:02:36.700
Not just simple slash commands,
and
00:02:36.700 --> 00:02:39.830
not just exposing existing APIs.
00:02:39.830 --> 00:02:43.330
But really enabling new
multi-step operations
00:02:43.330 --> 00:02:45.060
within a conversation.
00:02:45.060 --> 00:02:49.662
So conversation has this really
unique characteristic that in
00:02:49.662 --> 00:02:53.827
a conversational statement,
I can include a whole lot of
00:02:53.827 --> 00:02:56.604
information that
would take me many,
00:02:56.604 --> 00:02:59.240
many steps to operate
on a webpage.
00:02:59.240 --> 00:03:01.290
So for instance, I can say,
please book me a flight from
00:03:01.290 --> 00:03:03.310
San Francisco to
Los Angeles on Thursday.
00:03:03.310 --> 00:03:05.818
And within that, I got five or
six different fields in
00:03:05.818 --> 00:03:08.736
a webpage, I have a couple of
page navigations built into it.
00:03:08.736 --> 00:03:12.432
And yet, when I hand that
statement off to my assistant,
00:03:12.432 --> 00:03:16.128
my bot, they have all the
information they need to create
00:03:16.128 --> 00:03:17.519
the request at once.
00:03:18.840 --> 00:03:20.910
I think it also opens our
minds a little bit to
00:03:20.910 --> 00:03:21.940
where a bot can be.
00:03:23.330 --> 00:03:26.130
Those of you who saw the keynote
saw that we had a Weston bot
00:03:26.130 --> 00:03:27.740
that was embedded in Skype.
00:03:27.740 --> 00:03:30.570
Now the Weston bot came in and
00:03:30.570 --> 00:03:33.908
helped Lillian book a room
within an existing conversation.
00:03:33.908 --> 00:03:36.610
And text in conversations
have this other really great
00:03:36.610 --> 00:03:39.230
characteristic in that
they are highly portable.
00:03:39.230 --> 00:03:41.185
So you're not bound by
the user interfaces that you
00:03:41.185 --> 00:03:41.783
started with.
00:03:41.783 --> 00:03:43.050
It's not a desktop application,
00:03:43.050 --> 00:03:45.800
it's not a mobile application
that's stuck on a device.
00:03:45.800 --> 00:03:48.750
It can flow through the various
systems that your users
00:03:48.750 --> 00:03:51.370
already use,
existing conversations.
00:03:51.370 --> 00:03:54.090
New conversations on platforms
that they find to be convenient,
00:03:54.090 --> 00:03:55.705
it's helpful to text
your assistant,
00:03:55.705 --> 00:03:58.130
then it will be helpful to
you if you'd text your bot.
00:03:58.130 --> 00:04:00.300
And we think that this is
one of the things that will
00:04:00.300 --> 00:04:01.950
drive people to use
bots more and more.
00:04:03.570 --> 00:04:06.370
Now, the availability of these
bots on these platforms,
00:04:06.370 --> 00:04:09.470
is really what's gonna
push the bots forward.
00:04:09.470 --> 00:04:12.310
So the Weston bot is an example
of something that will
00:04:12.310 --> 00:04:15.250
help move people to expect
that bots and services will
00:04:15.250 --> 00:04:18.050
be available within their
existing conversations.
00:04:18.050 --> 00:04:20.350
Ultimately we expect
the conversation is going to be
00:04:20.350 --> 00:04:23.820
integral to all of the brands
and experiences that you have.
00:04:23.820 --> 00:04:26.600
And those conversations
are gonna flow directly to
00:04:26.600 --> 00:04:27.400
the users where they are.
00:04:27.400 --> 00:04:29.260
You're not gonna have
to install an app.
00:04:29.260 --> 00:04:30.920
You're not gonna have
to go to a webpage.
00:04:30.920 --> 00:04:33.770
You can just connect
directly with the brand or
00:04:33.770 --> 00:04:37.590
product where you are.
00:04:37.590 --> 00:04:40.290
So, as we begin the session and
we really get into the nitty
00:04:40.290 --> 00:04:43.300
gritty of building a bot,
I want you to think about
00:04:43.300 --> 00:04:47.640
how you would build really great
bots with these characteristics.
00:04:47.640 --> 00:04:50.670
What are problems that you
wanna solve in your businesses?
00:04:50.670 --> 00:04:52.270
What do your
products do already?
00:04:52.270 --> 00:04:54.240
What are the features
you would enable?
00:04:54.240 --> 00:04:55.790
Because if you have
these things in mind,
00:04:55.790 --> 00:04:57.480
I think you'll get a lot
more from the session.
00:04:57.480 --> 00:04:59.840
You'll be thinking about the
problems that you actually face.
00:04:59.840 --> 00:05:02.590
You'll be thinking about the
ways that your customers expect
00:05:02.590 --> 00:05:04.330
your product to work, and
00:05:04.330 --> 00:05:07.050
I think that'll help you
absorb a whole lot more in
00:05:07.050 --> 00:05:09.010
the session when we talk
about the Bot Framework.
00:05:10.290 --> 00:05:12.410
So okay, enough of all of that.
00:05:12.410 --> 00:05:14.170
Let's get back to the left side,
which is actually,
00:05:14.170 --> 00:05:16.049
how do we build this bot
that we wanna have exist?
00:05:17.060 --> 00:05:19.720
I mentioned earlier, we've
launched the Bot Framework.
00:05:19.720 --> 00:05:22.280
Just to give you a high level,
like a 100,000 foot level
00:05:22.280 --> 00:05:26.500
overview, the Bot Framework is
a Microsoft-operated service,
00:05:26.500 --> 00:05:28.450
which we call the Bot Connector,
and it's an SDK.
00:05:28.450 --> 00:05:30.150
And I'll tell you more
about those in a minute.
00:05:30.150 --> 00:05:32.840
But that's really the core
of the Bot Framework.
00:05:32.840 --> 00:05:35.680
But if you're looking to build
a bot, you're probably going to
00:05:35.680 --> 00:05:38.300
use more than just
the service and the SDK.
00:05:38.300 --> 00:05:40.330
You're going to
use many services.
00:05:40.330 --> 00:05:41.710
Services to host your bot.
00:05:41.710 --> 00:05:43.800
Services for natural language
and machine learning use,
00:05:43.800 --> 00:05:45.860
if you'd like to
incorporate that.
00:05:45.860 --> 00:05:46.460
Services for
00:05:46.460 --> 00:05:48.900
image processing if those are
the kinds of features you want.
00:05:48.900 --> 00:05:52.460
And so we think of the Bot
Framework as one of many tools
00:05:52.460 --> 00:05:57.000
and many tools that Microsoft
offers to build a fantastic bot.
00:05:57.000 --> 00:05:58.280
So some of these are those
like I mentioned.
00:05:58.280 --> 00:06:00.840
And we're gonna talk about
the Language Understanding and
00:06:00.840 --> 00:06:02.630
Intelligence Service, LUIS.
00:06:02.630 --> 00:06:04.650
In this session we're
actually gonna use it.
00:06:04.650 --> 00:06:06.960
But there's Speech APIs, Azure,
there are a whole lot more.
00:06:08.100 --> 00:06:09.220
Okay, so that's at
the 100,000 foot level,
00:06:09.220 --> 00:06:13.300
let's go down one step to
the 10,000 foot level to explain
00:06:13.300 --> 00:06:14.539
what a bot actually is.
00:06:15.980 --> 00:06:18.730
So let's take a couple
of examples here.
00:06:18.730 --> 00:06:21.300
Let's say that you want to
build a tic tac toe bot.
00:06:21.300 --> 00:06:23.000
And it'll be a really
great tic tac toe bot but
00:06:23.000 --> 00:06:26.250
the very core of the bot is
going to be logic that allows
00:06:26.250 --> 00:06:28.655
someone to play
the game tic tac toe.
00:06:28.655 --> 00:06:31.285
That logic is something that
exists within your product, or
00:06:31.285 --> 00:06:33.935
it exists within,
it's in your hands already, and
00:06:33.935 --> 00:06:37.180
that's not something that
we're going to define for you.
00:06:37.180 --> 00:06:38.165
You're gonna have that logic,
00:06:38.165 --> 00:06:39.835
you're gonna know what makes
sense for your customers.
00:06:41.375 --> 00:06:42.935
The logic could also be
something that connects
00:06:42.935 --> 00:06:43.465
to a web service.
00:06:43.465 --> 00:06:46.125
So we have a web service on
this diagram just to indicate
00:06:46.125 --> 00:06:49.490
that the logic inside your bot
may rely on external services.
00:06:49.490 --> 00:06:51.840
The Domino's Pizza bot relied
on an external service.
00:06:51.840 --> 00:06:55.340
Internally it put
together this pizza and
00:06:55.340 --> 00:06:57.670
then it sent it off to
the Domino's Rest API.
00:06:57.670 --> 00:06:59.370
But this is all your code.
00:07:00.630 --> 00:07:03.570
Now if we want to turn this into
a bot we need the ability for
00:07:03.570 --> 00:07:05.560
a user to send
a message to it and
00:07:05.560 --> 00:07:08.070
the bot to respond back with
whatever its response is.
00:07:08.070 --> 00:07:11.040
And if you're building a really
simple bot, you can add your own
00:07:11.040 --> 00:07:14.600
conversational logic into what
we're gonna call your bot.
00:07:14.600 --> 00:07:16.725
So in the pizza bot
example I showed you,
00:07:16.725 --> 00:07:19.580
this pizza bot that ordered this
pizza only accepted one command,
00:07:19.580 --> 00:07:21.030
really, and that was /order.
00:07:21.030 --> 00:07:22.420
And I just coded that on my own.
00:07:22.420 --> 00:07:24.520
That was my own
conversational logic.
00:07:24.520 --> 00:07:25.850
The bot didn't
really do very much.
00:07:25.850 --> 00:07:28.390
But it really was a bot because
it could receive a text string,
00:07:28.390 --> 00:07:29.990
do some work, and
then return a text string back.
00:07:31.160 --> 00:07:33.790
Now this is fine for
simple bots, but
00:07:33.790 --> 00:07:35.740
interesting bots need
a whole lot more complexity.
00:07:35.740 --> 00:07:38.740
And especially if you're trying
to do any sort of multi-step
00:07:38.740 --> 00:07:41.010
navigation or you want to
collect data from someone, or
00:07:41.010 --> 00:07:43.970
you're doing something that
requires permission, which of
00:07:43.970 --> 00:07:46.690
course we like to do when we
actually order someone a pizza.
00:07:46.690 --> 00:07:50.700
You probably will find that
writing that conversation
00:07:50.700 --> 00:07:53.080
on your own gets to
be really cumbersome.
00:07:53.080 --> 00:07:55.110
The code to manage
dialogue state,
00:07:55.110 --> 00:07:57.990
conversation state can
become really complex.
00:07:57.990 --> 00:08:00.605
And so, the first component of
the Bot Framework is something
00:08:00.605 --> 00:08:02.150
I'm gonna show you here.
00:08:02.150 --> 00:08:06.080
The Bot Builder SDK, which
you would use inside your bot
00:08:06.080 --> 00:08:08.800
to replace whatever your
basic conversation logic is.
00:08:08.800 --> 00:08:11.490
And that Bot Builder SDK
does all of the work in
00:08:11.490 --> 00:08:13.470
managing conversation state for
you.
00:08:13.470 --> 00:08:16.529
So this is a Node.js library or
00:08:16.529 --> 00:08:19.832
C# DLL that you
load in your bot.
00:08:19.832 --> 00:08:22.735
And you configure it, you give
it a couple of settings, and
00:08:22.735 --> 00:08:25.289
then it does all the work of
walking your user through
00:08:25.289 --> 00:08:27.440
the steps you want to
walk them through.
00:08:27.440 --> 00:08:30.429
If you want to add natural
language processing and machine
00:08:30.429 --> 00:08:33.906
learning skills, the Bot Builder
SDK integrates very cleanly with
00:08:33.906 --> 00:08:37.019
the Language Understanding
Intelligence Service, LUIS.
00:08:37.019 --> 00:08:40.500
And so that's a great
feature that you can use.
00:08:42.300 --> 00:08:46.070
Okay, so at this point we have
our bot, our bot has dialogue
00:08:46.070 --> 00:08:49.310
smarts, it can do natural
language processing but
00:08:49.310 --> 00:08:51.200
it doesn't talk to anyone.
00:08:51.200 --> 00:08:54.280
The strings that it receives and
returns are all just contained
00:08:54.280 --> 00:08:56.310
within this little
diagram that we've got.
00:08:56.310 --> 00:08:57.770
So now we want to
actually connect it up.
00:08:57.770 --> 00:08:59.130
And this is where
the second half
00:08:59.130 --> 00:09:01.380
of the Bot Framework comes in.
00:09:01.380 --> 00:09:04.690
So the other part that we're
gonna show is the Bot Connector.
00:09:04.690 --> 00:09:07.390
And the Bot Connector is
an online service that connects
00:09:07.390 --> 00:09:10.350
your bot seamlessly to
the services on the right hand
00:09:10.350 --> 00:09:11.440
side of the frame.
00:09:11.440 --> 00:09:16.300
Services like Skype,
Slack, Telegram, SMS,
00:09:16.300 --> 00:09:19.400
GroupMe, we have a lot of
services that we offer.
00:09:19.400 --> 00:09:23.460
And by implementing one simple
rest API interface in your bot,
00:09:23.460 --> 00:09:27.940
you get access to all of
these different channels.
00:09:27.940 --> 00:09:30.460
The send and receive to your bot
is just a simple web port call.
00:09:30.460 --> 00:09:32.980
So your bot simply has to be
available on the Internet.
00:09:32.980 --> 00:09:35.926
And if you've coded your own bot
in a language other than node.JS
00:09:35.926 --> 00:09:39.370
and C#, as long as you talk
our rest API message format,
00:09:39.370 --> 00:09:40.360
we'll use your bot.
00:09:40.360 --> 00:09:42.340
We've designed this as
an open platform and
00:09:42.340 --> 00:09:43.746
all of the pieces are pluggable.
00:09:43.746 --> 00:09:46.890
So if you've rigged your
bot on your own and
00:09:46.890 --> 00:09:48.250
you want to use it with
the Bot Connector and
00:09:48.250 --> 00:09:50.880
you're not using the Bot
Builder, that's totally cool.
00:09:50.880 --> 00:09:53.592
Just implement our interface,
and register it, and
00:09:53.592 --> 00:09:55.104
your bot will start talking.
00:09:55.104 --> 00:09:57.712
In addition to sending and
receiving messages, which is
00:09:57.712 --> 00:10:00.537
kind of a two core functions
that the Bot Connector performs,
00:10:00.537 --> 00:10:02.347
it has a bunch of
additional features.
00:10:02.347 --> 00:10:03.849
And I'll mention
these briefly but
00:10:03.849 --> 00:10:05.105
will show them more Later on.
00:10:05.105 --> 00:10:07.840
The first of these is
the ability to store state.
00:10:07.840 --> 00:10:10.101
So, if you're trying to keep
track of where a user is in
00:10:10.101 --> 00:10:12.706
the dialogue, whether they've
said yes or no to an answer, or
00:10:12.706 --> 00:10:15.660
if you're letting our bot
builder SDK manage that for you.
00:10:15.660 --> 00:10:18.890
The bot connector provides
storage within the service for
00:10:18.890 --> 00:10:20.459
your bot to store its
conversational state.
00:10:21.580 --> 00:10:23.300
It also provides
translation services,
00:10:23.300 --> 00:10:26.470
this is an optional service
that you can turn on.
00:10:26.470 --> 00:10:29.569
And your bot's messages
will be translated to and
00:10:29.569 --> 00:10:33.777
from your user's native language
into whatever you've coded your
00:10:33.777 --> 00:10:34.310
bot in.
00:10:34.310 --> 00:10:37.204
We use Bing Translation
technology to make this happen,
00:10:37.204 --> 00:10:39.796
and it can be really great
to expose your bot in other
00:10:39.796 --> 00:10:41.379
languages, and to new users.
00:10:42.700 --> 00:10:43.730
We also have telemetry.
00:10:43.730 --> 00:10:46.040
We have service-level
telemetry that we log, so
00:10:46.040 --> 00:10:48.845
if you have an app inside its
container, we can log telemetry
00:10:48.845 --> 00:10:51.547
about your bot directly to
that app inside its container.
00:10:51.547 --> 00:10:55.478
You'll probably want to have
your own service-level telemetry
00:10:55.478 --> 00:10:59.337
as well, but we provide, sorry,
your own application-level
00:10:59.337 --> 00:11:02.909
telemetry, but we provide
information about how long each
00:11:02.909 --> 00:11:06.409
of the calls to your bot take,
whether you have any failure
00:11:06.409 --> 00:11:09.498
calls, a failure message
is when we call your bot.
00:11:09.498 --> 00:11:12.769
And this can be really handy
when you're trying to debug
00:11:12.769 --> 00:11:13.400
your bot.
00:11:13.400 --> 00:11:15.964
Okay, I think actually it's
really easy to understand all of
00:11:15.964 --> 00:11:17.753
this, when we actually
look at a message.
00:11:17.753 --> 00:11:20.935
So here's one example of
JSON message that was sent
00:11:20.935 --> 00:11:23.451
between the bot connector and
your bot.
00:11:23.451 --> 00:11:24.510
I'm gonna run through.
00:11:24.510 --> 00:11:26.167
I've only left some
interesting fields in here.
00:11:26.167 --> 00:11:28.880
I've actually taken a lot out so
this is not a complete message.
00:11:28.880 --> 00:11:31.640
But, I'll run through
it from the top.
00:11:31.640 --> 00:11:33.590
First, the message
that was sent,
00:11:33.590 --> 00:11:37.610
in this case to your bot from
a user, is a message message.
00:11:37.610 --> 00:11:39.972
And so we have a number of
different message types within
00:11:39.972 --> 00:11:40.832
the bot framework.
00:11:40.832 --> 00:11:42.833
Message is one of them, but
00:11:42.833 --> 00:11:47.009
we also have system messages
to inform your bot that, for
00:11:47.009 --> 00:11:51.102
instance, a user has left or
joined the conversation.
00:11:51.102 --> 00:11:54.195
We also send information about
when your bot has left or joined
00:11:54.195 --> 00:11:57.479
a conversation, and we may have
more system messages over time.
00:11:57.479 --> 00:11:58.640
Next, we have a message id.
00:11:58.640 --> 00:12:01.870
And the message id is useful if
you want to reply to a message
00:12:01.870 --> 00:12:04.690
that was, if you wanna reply
specifically to a message,
00:12:04.690 --> 00:12:08.600
which can be really handy when
you have a conversation that
00:12:08.600 --> 00:12:10.870
take multiple paths, like email.
00:12:10.870 --> 00:12:13.280
So, if a user says something,
you may wanna respond
00:12:13.280 --> 00:12:15.990
specifically to that email,
and not necessarily to
00:12:15.990 --> 00:12:17.860
the way that the email thread
has diverged over time.
00:12:19.180 --> 00:12:21.310
Next, we have a conversationId,
which allows your bot
00:12:21.310 --> 00:12:24.010
to correlate all the traffic
across one conversation.
00:12:24.010 --> 00:12:27.553
We have the language that we
think the user specified.
00:12:27.553 --> 00:12:31.913
The language that the user used
when they gave us their input
00:12:31.913 --> 00:12:32.441
text.
00:12:32.441 --> 00:12:35.780
And we provide facilities for
the user to customize and say,
00:12:35.780 --> 00:12:37.032
hey, I speak French.
00:12:37.032 --> 00:12:39.053
And then, we start treating
their language as French and
00:12:39.053 --> 00:12:40.619
translating it into
whatever you'd like.
00:12:41.830 --> 00:12:43.790
We have a set of attachment
fields which can be binary
00:12:43.790 --> 00:12:45.950
attachments, we
provide you URLs but
00:12:45.950 --> 00:12:48.530
they can be images,
documents and so forth.
00:12:48.530 --> 00:12:51.430
And then we give you
the addressing information
00:12:51.430 --> 00:12:52.430
of the user.
00:12:52.430 --> 00:12:55.090
What we don't wanna do in the
bot framework is we don't want
00:12:55.090 --> 00:12:57.630
to paper over all the services
that you're using so
00:12:57.630 --> 00:12:59.700
that you don't get the
information you would get from
00:12:59.700 --> 00:13:01.940
them as if you were
using them directly.
00:13:01.940 --> 00:13:04.930
So we're providing you
with the actual SMS number
00:13:04.930 --> 00:13:08.130
that you would get if you were
using a service like Twilio.
00:13:08.130 --> 00:13:10.700
We don't hide that, we don't
cover it up with our own user
00:13:10.700 --> 00:13:14.430
id, we do give you a user id
that we track internally inside
00:13:14.430 --> 00:13:17.300
the bot framework, but this
number is something that you
00:13:17.300 --> 00:13:19.000
would get if you were using
that service directly.
00:13:20.036 --> 00:13:22.310
And then skipping down to
the bottom two fields,
00:13:22.310 --> 00:13:25.580
we have a way to pass through
high fidelity information
00:13:25.580 --> 00:13:27.080
specific to each channel.
00:13:27.080 --> 00:13:30.703
So if you're communicating
over Skype, for instance,
00:13:30.703 --> 00:13:34.702
Skype supports some additional
items within their API that may
00:13:34.702 --> 00:13:38.627
be available in this channelData
field that you can use to talk
00:13:38.627 --> 00:13:40.908
the high fidelity
Skype language.
00:13:40.908 --> 00:13:45.580
Even though your bot just has
basic texting to say, back and
00:13:45.580 --> 00:13:46.510
forth.
00:13:46.510 --> 00:13:49.620
So, if you're interested in
using those extra features,
00:13:49.620 --> 00:13:52.805
the channelData field is the way
that we wire those through.
00:13:52.805 --> 00:13:54.064
And lastly we have
the botUserData,
00:13:54.064 --> 00:13:55.778
which is that state that
we talked about earlier.
00:13:55.778 --> 00:13:58.634
And this is just an async state
that you can put information in
00:13:58.634 --> 00:14:00.258
and the data goes back and
forth and
00:14:00.258 --> 00:14:03.170
the bot connector manages the
lifetime of that state for you.
00:14:04.880 --> 00:14:06.361
Okay, so at this point,
00:14:06.361 --> 00:14:09.191
this is all I'm gonna
show you on the messages.
00:14:09.191 --> 00:14:11.151
I think it'll be a little
bit clearer too,
00:14:11.151 --> 00:14:12.750
when we look at
some of the code.
00:14:12.750 --> 00:14:14.520
And so to walk you through
the process of a new bot,
00:14:14.520 --> 00:14:17.130
I'm gonna welcome
on stage Mike Hall,
00:14:17.130 --> 00:14:20.900
who's a principal architect
in Microsoft Research.
00:14:20.900 --> 00:14:22.581
Welcome, Mike.
00:14:22.581 --> 00:14:27.794
>> [APPLAUSE]
>> I am ready.
00:14:27.794 --> 00:14:28.412
>> And we're gonna
00:14:28.412 --> 00:14:30.140
go through each of the steps
that you see here.
00:14:30.140 --> 00:14:32.078
We're gonna blast through
these as quickly as we can.
00:14:32.078 --> 00:14:34.562
And we're gonna start with just
a bare Visual Studio template,
00:14:34.562 --> 00:14:36.730
which is available on
the botframework.com website.
00:14:36.730 --> 00:14:39.110
And then we're gonna go
through each of the steps
00:14:39.110 --> 00:14:42.940
of creating a simple bot, in
this case, a simple stock bot,
00:14:42.940 --> 00:14:45.230
adding in natural language
processing and so forth.
00:14:45.230 --> 00:14:46.620
We'll go through
these one by one.
00:14:48.390 --> 00:14:50.426
>> Okay,
who wants to build a bot?
00:14:50.426 --> 00:14:53.400
>> [APPLAUSE]
>> Okay,
00:14:53.400 --> 00:14:54.977
who want's to build a bot?
00:14:54.977 --> 00:14:58.861
>> [APPLAUSE]
>> Great, okay so
00:14:58.861 --> 00:15:04.090
I'm in Visual Studio 2015, I'm
going to create a new project.
00:15:04.090 --> 00:15:06.650
We've already got the SDK
installed, so I've got
00:15:06.650 --> 00:15:10.822
the template for building this
new bot application here.
00:15:10.822 --> 00:15:15.671
I'm gonna give this a name,
as Dan mentioned, of StockBot.
00:15:15.671 --> 00:15:19.059
We're gonna build a bot over
a number of different levels to
00:15:19.059 --> 00:15:22.381
allow you to query various
stocks and potentially even get
00:15:22.381 --> 00:15:24.710
to the level of buying or
selling stock.
00:15:25.920 --> 00:15:28.060
Okay, so
I'm going to hit Next, and
00:15:28.060 --> 00:15:29.570
that will generate
the application.
00:15:30.880 --> 00:15:34.120
There are a few things to point
out about the default template
00:15:34.120 --> 00:15:36.630
application that's
just been generated, or
00:15:36.630 --> 00:15:38.730
is actually being generated.
00:15:38.730 --> 00:15:42.680
So the first thing is that the
bot itself is gonna be hosted
00:15:42.680 --> 00:15:46.200
somewhere on the Internet so
that the bot connector
00:15:46.200 --> 00:15:49.480
can send and
receive messages from your bot.
00:15:49.480 --> 00:15:53.080
So we need to be able to secure
the channel between your bot and
00:15:53.080 --> 00:15:54.230
the bot connector.
00:15:54.230 --> 00:15:56.980
The way in which we do this is
through this file called web
00:15:56.980 --> 00:16:03.320
config where we have the app id
and the app secret for your bot.
00:16:03.320 --> 00:16:08.243
What I'm going to do is give
this an AppId of YourAppId1 and
00:16:08.243 --> 00:16:09.920
YourAppSecret1.
00:16:11.080 --> 00:16:15.120
When I develop the bot, build
it, deploy it, use this bot,
00:16:15.120 --> 00:16:18.720
initially I'm just gonna
be using this on my PC, and
00:16:18.720 --> 00:16:21.680
I'm gonna be talking to it
through a device emulator.
00:16:21.680 --> 00:16:26.100
Which is emulating messaging
between a user and the bot.
00:16:26.100 --> 00:16:29.320
When we get to publish this,
in this case up to Azure,
00:16:29.320 --> 00:16:32.860
we will need obviously a more
secure AppId and app key, and
00:16:32.860 --> 00:16:36.030
Dan will walk us through that
process in just a few minutes.
00:16:36.030 --> 00:16:39.040
Okay, so
that's the web config modified.
00:16:39.040 --> 00:16:42.580
The other file to take a look at
here is this default.htm file.
00:16:43.600 --> 00:16:46.620
This has some basic data
in it saying describe your
00:16:46.620 --> 00:16:47.560
bot and so on.
00:16:47.560 --> 00:16:51.250
Again, if your bot is
public on live Internet,
00:16:51.250 --> 00:16:54.220
that means that it's on
a reachable IP address and
00:16:54.220 --> 00:16:56.470
somebody could
potentially browse there.
00:16:56.470 --> 00:16:59.360
And so you want to give some
information to that person about
00:16:59.360 --> 00:17:03.600
your bot usage, terms and
conditions, and so on.
00:17:03.600 --> 00:17:06.580
>> And if you want customers
when they land on that page to
00:17:06.580 --> 00:17:07.600
actually use your bot,
00:17:07.600 --> 00:17:10.070
this is a place where you can
embed the bot connector's
00:17:10.070 --> 00:17:12.650
web chat control which I showed
briefly in the keynote demo.
00:17:12.650 --> 00:17:14.352
I don't know that we're gonna
have time to go over it today
00:17:14.352 --> 00:17:15.264
but you can drop that in there.
00:17:15.264 --> 00:17:17.365
>> Yeah, probably not,
but yes, good point.
00:17:17.365 --> 00:17:19.750
Okay, so now lets get
into the code itself.
00:17:19.750 --> 00:17:23.820
So the template produces
the main entry point for
00:17:23.820 --> 00:17:25.060
your bot application and
00:17:25.060 --> 00:17:29.040
that's this function here
which is the Post function.
00:17:29.040 --> 00:17:32.030
You can see that this
returns a message and
00:17:32.030 --> 00:17:34.340
it takes in a message.
00:17:34.340 --> 00:17:36.831
And Dan briefly showed you
a couple of seconds ago
00:17:36.831 --> 00:17:37.931
the message format.
00:17:37.931 --> 00:17:40.508
So there are a number of
interesting things within that
00:17:40.508 --> 00:17:42.730
message, one of which
is the message.Type.
00:17:42.730 --> 00:17:45.360
And obviously,
things like message.Text
00:17:45.360 --> 00:17:47.720
which will be the text that the
user has sent to your bot for
00:17:47.720 --> 00:17:49.490
you do some work on.
00:17:49.490 --> 00:17:52.660
So what we can see within
the default application is if
00:17:52.660 --> 00:17:55.190
the message.Type is Message,
00:17:55.190 --> 00:17:59.280
which means this is the text
the user has sent your bot.
00:17:59.280 --> 00:18:01.718
What we're going to do is
just calculate the length of
00:18:01.718 --> 00:18:05.070
the string that the user
has sent to you.
00:18:05.070 --> 00:18:08.100
And then we're going to
create a reply message saying
00:18:08.100 --> 00:18:09.550
your string is this long.
00:18:09.550 --> 00:18:10.590
Okay, does that make sense?
00:18:11.750 --> 00:18:12.820
Fairly straightforward, right?
00:18:12.820 --> 00:18:15.089
You get a message in,
you process the message,
00:18:15.089 --> 00:18:18.001
you generate the reply message,
you send the message back.
00:18:18.001 --> 00:18:19.301
So that's pretty
straightforward.
00:18:19.301 --> 00:18:21.760
That's the standard message.
00:18:21.760 --> 00:18:22.720
But as Dan mentioned,
00:18:22.720 --> 00:18:26.060
there's also this notion
of system messages.
00:18:26.060 --> 00:18:28.310
And so there are a number of
messages that can be delivered
00:18:28.310 --> 00:18:32.310
not necessarily from a user
initiated message, but in
00:18:32.310 --> 00:18:36.220
this case, for things like a bot
being added to a conversation or
00:18:36.220 --> 00:18:41.480
leaving a conversation,
a user being added,
00:18:41.480 --> 00:18:44.200
a user leaving or
a conversation ending.
00:18:44.200 --> 00:18:47.300
So the default template
gives you the handler here
00:18:47.300 --> 00:18:50.910
called HandleSystemMessage
with a number of these
00:18:52.440 --> 00:18:56.450
messages kind of handled but
without any actual return.
00:18:56.450 --> 00:19:00.140
So let's, in our case, hook
up one of these messages and
00:19:00.140 --> 00:19:04.270
I'm going to use the
BotAddedToConversation message.
00:19:04.270 --> 00:19:06.996
So, what I'm gonna
return here is message,
00:19:06.996 --> 00:19:11.101
remember we've already seen this
is in the default template code.
00:19:11.101 --> 00:19:14.322
We'd taken a message and we
can use that message to create
00:19:14.322 --> 00:19:17.630
the reply message, with the text
that we wanna send back.
00:19:17.630 --> 00:19:21.630
So I'm gonna say
CreateReplyMessage and
00:19:21.630 --> 00:19:25.280
because this is coming from
a bot, added to the conversation
00:19:25.280 --> 00:19:30.590
rather than human, I'm going
to say, Hello Botty McBotface.
00:19:33.070 --> 00:19:34.520
Only seems appropriate, right?
00:19:35.660 --> 00:19:39.210
Okay, so I'm not gonna make
any additional changes.
00:19:39.210 --> 00:19:42.170
I'm gonna build this,
I'm going to run this.
00:19:42.170 --> 00:19:44.310
And what's gonna happen is
this is gonna get deployed.
00:19:44.310 --> 00:19:48.049
IIS Express is running
on the local machine.
00:19:48.049 --> 00:19:52.090
We'll see the default page for
the bot getting launched.
00:19:52.090 --> 00:19:55.631
And so
now the bot is actively running.
00:19:55.631 --> 00:19:59.223
I've got the emulator
already running here.
00:19:59.223 --> 00:20:02.261
This gives me the ability to
test not only system messages,
00:20:02.261 --> 00:20:03.901
but user messages
into the bot so
00:20:03.901 --> 00:20:05.737
we can try out some
of these things.
00:20:05.737 --> 00:20:09.547
The first things noticed
is the top left hand side,
00:20:09.547 --> 00:20:14.155
the IP address of the bot is
local host, here's the port, and
00:20:14.155 --> 00:20:18.760
then the path to the message
handler within the bot.
00:20:18.760 --> 00:20:22.190
I also have my app ID,
and my app Secret.
00:20:22.190 --> 00:20:24.410
Since the bot could be
deployed into Azure,
00:20:24.410 --> 00:20:26.220
that means it's
on a public site.
00:20:26.220 --> 00:20:29.990
I'd obviously want to change the
URI to the bot and also the app
00:20:29.990 --> 00:20:32.870
Secrets to match the real app
Secrets in my deploy box.
00:20:34.320 --> 00:20:37.330
I can drop down here where I
can send a system message.
00:20:37.330 --> 00:20:38.160
So let's go ahead and
00:20:38.160 --> 00:20:42.600
send a system message for
a bot added conversation.
00:20:42.600 --> 00:20:44.590
And then we see straight
away we get message back,
00:20:44.590 --> 00:20:46.502
hello Botty McBotface.
00:20:46.502 --> 00:20:48.341
[LAUGH] Amazing.
00:20:49.490 --> 00:20:52.150
>> What is going on on
the right pane there?
00:20:52.150 --> 00:20:55.680
>> Okay, so on the left hand
side we see what the user see as
00:20:55.680 --> 00:20:56.534
part of the conversation.
00:20:56.534 --> 00:20:59.210
On the right hand side what
we're seeing is a breakdown
00:20:59.210 --> 00:21:01.810
of that message format
that you displayed
00:21:01.810 --> 00:21:03.690
up on the slide a couple
of minutes ago, right?
00:21:03.690 --> 00:21:07.240
So if you're wanting
to debug your box and
00:21:07.240 --> 00:21:10.530
have a look at the messages
being sent backwards and
00:21:10.530 --> 00:21:12.080
forwards in its raw form.
00:21:12.080 --> 00:21:14.300
You can just take a direct look
at the JSON that's shown on
00:21:14.300 --> 00:21:15.780
the right hand side.
00:21:15.780 --> 00:21:18.460
Obviously we want to send
a real message to the bot.
00:21:18.460 --> 00:21:21.900
So I'm gonna type,
hello world, hit Enter, and
00:21:21.900 --> 00:21:24.110
I send 11 characters to the bot.
00:21:24.110 --> 00:21:24.700
Isn't that amazing?
00:21:24.700 --> 00:21:27.547
Yes.
00:21:27.547 --> 00:21:29.750
>> [APPLAUSE]
>> Okay.
00:21:31.210 --> 00:21:34.217
>> But you're probably
asking yourself, hey so
00:21:34.217 --> 00:21:36.845
what does this have
to do with stock bot?
00:21:36.845 --> 00:21:37.345
>> [LAUGH]
>> Okay.
00:21:37.345 --> 00:21:38.785
So let's go ahead and
00:21:38.785 --> 00:21:41.305
add some additional
functionality into the bot.
00:21:41.305 --> 00:21:43.770
I'm going to add a new class,
00:21:43.770 --> 00:21:45.200
I'm going to call this Yahoo.
00:21:45.200 --> 00:21:49.120
We're gonna be using
the Yahoo Web API to go and
00:21:49.120 --> 00:21:50.420
look up a stock, right?
00:21:50.420 --> 00:21:55.021
So I'm now going to type
in some code to call into
00:21:55.021 --> 00:21:57.450
that Yahoo web service.
00:21:57.450 --> 00:21:58.640
>> You're such a fast typer.
00:21:58.640 --> 00:22:00.635
>> It has been said before.
00:22:00.635 --> 00:22:03.590
[LAUGH] Okay so this is really
straight forward right?
00:22:03.590 --> 00:22:06.210
This is just using web client,
you can see the URI.
00:22:06.210 --> 00:22:10.070
The way in which this
works is it's going to be
00:22:10.070 --> 00:22:11.570
returning a double.
00:22:11.570 --> 00:22:16.400
Out of the call to
the Yahoo stock service and
00:22:16.400 --> 00:22:18.450
if the stock is real
we get the value and
00:22:18.450 --> 00:22:20.990
if it's not real we get
no return on the double.
00:22:22.060 --> 00:22:22.590
Okay, so
00:22:22.590 --> 00:22:25.890
I don't need to do anything
else into the Yahoo class.
00:22:25.890 --> 00:22:29.060
If I come back into my
application, what I'm going
00:22:29.060 --> 00:22:32.250
to do is add in a little
bit of extra code here for
00:22:32.250 --> 00:22:34.220
this function called GetStock.
00:22:34.220 --> 00:22:38.100
And what this is gonna do is
call that Yahoo web service.
00:22:38.100 --> 00:22:40.160
And if I get null for
the return,
00:22:40.160 --> 00:22:43.180
meaning it's not a valid picker,
then I'm going to return
00:22:43.180 --> 00:22:45.890
a message saying this stock
doesn't appear to be valid.
00:22:45.890 --> 00:22:48.350
Or I'm gonna return the stock
in the current value.
00:22:48.350 --> 00:22:51.320
Okay, so
it's fairly straight forward.
00:22:51.320 --> 00:22:54.050
The only other thing that I need
to change is to go up to our
00:22:54.050 --> 00:22:55.880
message handler and
00:22:55.880 --> 00:22:59.720
put in some kind of string
return to call the get stock
00:22:59.720 --> 00:23:02.210
function and then return
that data back to the user.
00:23:02.210 --> 00:23:06.265
So, I'm gonna say
string strStock equals
00:23:06.265 --> 00:23:10.720
await get stock, and
pass in message,
00:23:10.720 --> 00:23:15.680
this is the inbound message
from the user .txt.
00:23:15.680 --> 00:23:21.100
Which is the text that we get
from the user calling our bot.
00:23:22.280 --> 00:23:25.283
So the next thing I’m
gonna do is replace the,
00:23:25.283 --> 00:23:29.056
what we had was you sent so
many characters with strStock.
00:23:29.056 --> 00:23:32.790
So that's all the changes
I need to make to the bot.
00:23:32.790 --> 00:23:35.120
To be able to call out
to the Yahoo service,
00:23:35.120 --> 00:23:37.920
get the data back, and
then respond back to the user.
00:23:37.920 --> 00:23:39.160
So I'm gonna build that.
00:23:39.160 --> 00:23:40.470
Build succeeds.
00:23:40.470 --> 00:23:41.630
Launch that.
00:23:41.630 --> 00:23:45.280
We get the webpage being
displayed as before.
00:23:45.280 --> 00:23:48.910
And then I should be able to
go back to the emulator and
00:23:48.910 --> 00:23:50.040
give it a stock.
00:23:50.040 --> 00:23:53.720
So I'm gonna start with
my favorite ticker name.
00:23:53.720 --> 00:23:56.200
And that doesn't
appear to be valid.
00:23:56.200 --> 00:23:58.370
So I can obviously
choose something else,
00:23:58.370 --> 00:24:01.470
like Microsoft, and
I get the stock value back.
00:24:01.470 --> 00:24:05.942
Okay, so great, fantastic,
that's looking a lot more like
00:24:05.942 --> 00:24:08.531
a stock bot I think
you would agree.
00:24:08.531 --> 00:24:09.076
Yes.
00:24:09.076 --> 00:24:16.200
>> [APPLAUSE]
>> But wait there's more.
00:24:16.200 --> 00:24:19.690
What we've seen so
far is we've built a basic bot.
00:24:19.690 --> 00:24:21.230
We're calling out to
a Yahoo web service,
00:24:21.230 --> 00:24:22.940
we're getting some data back and
00:24:22.940 --> 00:24:24.520
we're returning that
back to the user.
00:24:24.520 --> 00:24:27.000
But it's not very
conversational yet.
00:24:27.000 --> 00:24:30.440
I as the user had to understand
that the thing I give it
00:24:30.440 --> 00:24:33.090
is a ticker name and
I get a response back.
00:24:33.090 --> 00:24:34.330
Wouldn't it be much better for
00:24:34.330 --> 00:24:37.090
me to be able to type a message
or a string that says something
00:24:37.090 --> 00:24:40.870
like, what is the current
value of Microsoft stock?
00:24:40.870 --> 00:24:43.340
So one of the things that
Dan talked about earlier is
00:24:43.340 --> 00:24:46.440
the language understanding
intelligence service, or LUIS.
00:24:46.440 --> 00:24:49.720
So why don't we now use
LUIS to integrate some
00:24:49.720 --> 00:24:52.860
natural language processing
into this application?
00:24:53.908 --> 00:24:57.000
Okay, so I'm gonna minimize
Visual Studio for a second and
00:24:57.000 --> 00:24:58.100
the emulator.
00:24:58.100 --> 00:25:01.710
I'm gonna go to LOUIS and
I've already got a model
00:25:01.710 --> 00:25:05.280
that is built out in LOUIS
that we'll take a look at.
00:25:05.280 --> 00:25:11.360
That shows us how we can deal
with in this case a stock model.
00:25:11.360 --> 00:25:14.276
So, here's the stock model and
when we think about LOUIS,
00:25:14.276 --> 00:25:15.910
there are two things
that we're interested in.
00:25:15.910 --> 00:25:19.310
One of which is intense, and
that is what I want to do.
00:25:19.310 --> 00:25:21.203
So, you can think
of intent being,
00:25:21.203 --> 00:25:22.666
get me the value of a stock.
00:25:22.666 --> 00:25:26.343
Or buy some stock or show me the
last stock that I was interested
00:25:26.343 --> 00:25:30.230
in or potentially something
like is the market up or down?
00:25:30.230 --> 00:25:33.560
That would be the intent and
then we also have entities.
00:25:33.560 --> 00:25:36.460
So in the case of requesting
a certain type of stock,
00:25:36.460 --> 00:25:39.380
show me the value
of Microsoft stock.
00:25:39.380 --> 00:25:41.477
In that case the entity
would be Microsoft.
00:25:41.477 --> 00:25:43.405
That's the thing that we're
interested in looking
00:25:43.405 --> 00:25:44.450
for, right?
00:25:44.450 --> 00:25:47.121
So I've got a number of,
an amount and
00:25:47.121 --> 00:25:49.240
data that is already
build into this thing.
00:25:49.240 --> 00:25:51.090
You can see when
I bring this up.
00:25:51.090 --> 00:25:54.088
There's extensive training
that has gone into this model.
00:25:54.088 --> 00:25:55.876
We have about four
items in the list.
00:25:55.876 --> 00:25:57.455
All right.
00:25:57.455 --> 00:25:59.800
And you can see that I can
ask a number of things.
00:25:59.800 --> 00:26:01.510
Tell me the price of Tesla.
00:26:01.510 --> 00:26:03.250
What is the price of Tesla?
00:26:03.250 --> 00:26:04.710
Show me the price for Microsoft.
00:26:04.710 --> 00:26:05.630
What is Apple at today?
00:26:05.630 --> 00:26:06.890
Those kinds of things.
00:26:06.890 --> 00:26:10.060
So that would be the kind of
thing that I would expect
00:26:10.060 --> 00:26:13.470
the user to send and then from
that I can get the intent.
00:26:13.470 --> 00:26:16.631
Which is show me the stock value
and the entity, which would
00:26:16.631 --> 00:26:19.740
Tesla, Microsoft, Apple,
or whatever it's gonna be.
00:26:21.250 --> 00:26:22.760
Okay, so that's pretty neat.
00:26:22.760 --> 00:26:25.360
So I can do a number of things,
I can modify this and
00:26:25.360 --> 00:26:27.930
publish it if I click
on the Publish link.
00:26:27.930 --> 00:26:31.940
You can see the URL,
the URI for the service.
00:26:31.940 --> 00:26:36.770
I can also put some basic query.
00:26:36.770 --> 00:26:39.765
So show me Microsoft for
example.
00:26:39.765 --> 00:26:43.076
And if I click the link that
will return the result of
00:26:43.076 --> 00:26:45.848
calling into that LOUIS
model with the text
00:26:45.848 --> 00:26:48.090
that I've just entered.
00:26:48.090 --> 00:26:50.490
So what we can see
here is the intents,
00:26:50.490 --> 00:26:51.760
hopefully you can see this.
00:26:51.760 --> 00:26:55.749
The intents at the top of the
screen showing stock price is
00:26:55.749 --> 00:26:56.755
the best hit.
00:26:56.755 --> 00:26:59.739
And then at the bottom we have
the entities showing Microsoft
00:26:59.739 --> 00:27:02.400
as the symbol that
we're interested in.
00:27:02.400 --> 00:27:05.550
All right, so one of the neat
things that we can do is just
00:27:05.550 --> 00:27:09.530
grab all of that JSON that we
get back from the LOUIS model.
00:27:09.530 --> 00:27:12.860
We can then come
into Visual Studio,
00:27:12.860 --> 00:27:16.585
right click add a new class,
I'm gonna call this LOUIS.
00:27:18.110 --> 00:27:23.047
And then if I just delete this
place holder, I can come to
00:27:23.047 --> 00:27:27.998
the edit menu, paste special,
paste JSON as classes.
00:27:27.998 --> 00:27:30.304
Which would just generate all
the class information for
00:27:30.304 --> 00:27:31.620
me directly.
00:27:31.620 --> 00:27:32.825
So that's pretty neat, right?
00:27:32.825 --> 00:27:38.150
>> [APPLAUSE]
>> We didn't even build that.
00:27:38.150 --> 00:27:39.936
This is just the thing that's
been built into Visual Studio.
00:27:39.936 --> 00:27:44.410
>> However, [LAUGH] thanks for
the applause.
00:27:44.410 --> 00:27:44.910
>> Yeah.
00:27:46.060 --> 00:27:47.020
>> Okay so
00:27:47.020 --> 00:27:50.960
I've just replaced the paste
with some additional code.
00:27:50.960 --> 00:27:53.360
There's a function here
[INAUDIBLE] user input.
00:27:53.360 --> 00:27:56.850
So what this is gonna do is
call out to that LOUIS model
00:27:56.850 --> 00:27:58.790
using a HTP call.
00:27:58.790 --> 00:28:00.560
And then return
the results back.
00:28:00.560 --> 00:28:05.570
And what we're going to get
back is a class that contains
00:28:05.570 --> 00:28:11.350
the intent and entities for
making that call, great.
00:28:11.350 --> 00:28:14.480
So that's the LOUIS piece done.
00:28:14.480 --> 00:28:17.030
So I'm gonna close that down.
00:28:17.030 --> 00:28:20.650
I'm gonna come back to
our application code, so
00:28:20.650 --> 00:28:22.340
here's our post function.
00:28:22.340 --> 00:28:24.650
You can see here's
our if message.
00:28:24.650 --> 00:28:26.890
Which is currently just getting
the raw stock name like
00:28:26.890 --> 00:28:30.060
Microsoft or Tesla or whatever.
00:28:30.060 --> 00:28:33.250
So I'm gonna replace this
with slightly more code
00:28:33.250 --> 00:28:36.060
and what we'll do is just take
a walk through what's happening
00:28:36.060 --> 00:28:37.320
inside of this code.
00:28:37.320 --> 00:28:40.450
So as before,
we're checking the message type.
00:28:40.450 --> 00:28:41.800
Is this a message from a user?
00:28:41.800 --> 00:28:42.750
Yes it is.
00:28:42.750 --> 00:28:46.240
We'll come back to this thing,
set stock falls in a second.
00:28:46.240 --> 00:28:49.050
One of the things that Dan
mentioned earlier is that we
00:28:49.050 --> 00:28:56.160
have the ability to persist data
across messages into your bot.
00:28:56.160 --> 00:28:58.120
Your bot is in effect stateless.
00:28:58.120 --> 00:29:07.480
It's an http endpoint, so
when you receive a message.
00:29:07.480 --> 00:29:11.850
That message would obviously
contain some text, and what we
00:29:11.850 --> 00:29:15.430
might want to do is, in effect,
have a rolling conversation.
00:29:15.430 --> 00:29:16.420
So, I might want to ask,
00:29:16.420 --> 00:29:19.710
in this case,
what is Microsoft stock at?
00:29:19.710 --> 00:29:21.790
And then later on I might want
to ask well how about now,
00:29:21.790 --> 00:29:23.000
what's it at now?
00:29:23.000 --> 00:29:25.990
So, I want to be able
to get that last
00:29:25.990 --> 00:29:29.240
intent out of the system so
I can persist that.
00:29:29.240 --> 00:29:31.940
So what I'm saying here
is set stock is full so
00:29:31.940 --> 00:29:34.690
we'll come back to why I'm
doing that in a second.
00:29:34.690 --> 00:29:36.170
So here's the call into LOUIS.
00:29:36.170 --> 00:29:41.930
I get the stop LOUIS class back,
and I'm setting
00:29:41.930 --> 00:29:46.740
up now ready to provide the
return text back to the user.
00:29:46.740 --> 00:29:48.270
So I'm checking the intents,
00:29:48.270 --> 00:29:50.840
the number of intents that
I get back from LOUIS.
00:29:50.840 --> 00:29:53.275
If it's zero then I'm going
to reply to the user saying,
00:29:53.275 --> 00:29:55.670
I'm sorry, I don't understand
what you're asking.
00:29:55.670 --> 00:30:00.423
Otherwise I'm gonna switch on
the zero element of the intents,
00:30:00.423 --> 00:30:04.471
the one that has the highest
ranking out of the input for
00:30:04.471 --> 00:30:05.275
the user.
00:30:05.275 --> 00:30:07.295
And then do something
based on that.
00:30:07.295 --> 00:30:10.701
So one of the intents that we
saw when we went to the LUIS
00:30:10.701 --> 00:30:13.440
site was the intent for
RepeatLastStock.
00:30:13.440 --> 00:30:16.330
So if I've just asked for
Microsoft stock, five
00:30:16.330 --> 00:30:19.560
minutes later I might ask well,
how about now, what's it at now.
00:30:19.560 --> 00:30:24.249
So that would be my intent,
to repeat the last stock.
00:30:24.249 --> 00:30:28.695
What we're doing on the next
line is we're making a call on
00:30:28.695 --> 00:30:32.324
message to get bot user
data of type string, and
00:30:32.324 --> 00:30:34.170
then last stock.
00:30:34.170 --> 00:30:36.010
You can think of this
as a property bag
00:30:36.010 --> 00:30:37.330
based on the message.
00:30:37.330 --> 00:30:41.030
So I have the ability in this
case to query the message for
00:30:41.030 --> 00:30:45.260
in this case last stock in
the property bag of the message,
00:30:45.260 --> 00:30:46.460
to return me a string.
00:30:46.460 --> 00:30:49.530
Which will be the last stock
name that I searched on.
00:30:49.530 --> 00:30:50.300
Does that make sense?
00:30:51.470 --> 00:30:51.970
Great.
00:30:53.200 --> 00:30:55.780
So if there isn't anything
in the property bag, I can
00:30:55.780 --> 00:30:58.305
then simply return a message
saying I don't have previous
00:30:58.305 --> 00:30:58.860
stock to look at.
00:31:00.890 --> 00:31:03.960
If I do have something, then I
can obviously just go ahead and
00:31:03.960 --> 00:31:05.634
make a call back
to the same stock,
00:31:05.634 --> 00:31:08.900
GetStock function that we
saw a couple of minutes ago
00:31:08.900 --> 00:31:11.340
which will return me
the value for that stock.
00:31:11.340 --> 00:31:14.510
And then, obviously,
I can push that out to the user.
00:31:14.510 --> 00:31:19.410
If the intent is stock price,
then I set the flag to say, yes,
00:31:19.410 --> 00:31:20.740
I want to set the stock, and
00:31:20.740 --> 00:31:23.260
we'll see exactly why we're
doing that in a second.
00:31:23.260 --> 00:31:25.230
And then I make a call to
the getStock function,
00:31:25.230 --> 00:31:27.740
which will obviously give me the
string to return to the user.
00:31:29.150 --> 00:31:33.925
Now, what we've seen before
is we had this return,
00:31:33.925 --> 00:31:36.870
message.CreateReplyMessage.
00:31:36.870 --> 00:31:37.430
In this case,
00:31:37.430 --> 00:31:40.770
what I'm doing is pulling out
the reply message specifically.
00:31:40.770 --> 00:31:42.800
So I'm saying
Message ReplyMessage
00:31:42.800 --> 00:31:44.895
= message.CreateReplyMessage and
00:31:44.895 --> 00:31:48.410
obviously parsing in the string
that we want to reply.
00:31:48.410 --> 00:31:50.930
But the reason why I'm calling
that out rather than just
00:31:50.930 --> 00:31:54.270
returning the message is because
I want to set the property in
00:31:54.270 --> 00:31:58.230
the property bag if the flag has
been set to store the stock.
00:31:59.370 --> 00:32:04.360
So I'm saying if set stock,
then on the reply message,
00:32:04.360 --> 00:32:06.880
set the bot user data
in the property bag for
00:32:06.880 --> 00:32:09.160
this thing called LastStock.
00:32:09.160 --> 00:32:15.090
And then the entity that we just
queried to return to the user.
00:32:15.090 --> 00:32:16.640
And then we return
with a message.
00:32:16.640 --> 00:32:19.720
And the rest of the code is
exactly as we've seen it before.
00:32:19.720 --> 00:32:22.670
If it’s not a user
initiated message,
00:32:22.670 --> 00:32:25.800
it must be a system message so
we handle that in the same way.
00:32:25.800 --> 00:32:27.040
Okay, everyone happy with that?
00:32:28.700 --> 00:32:29.520
Great.
00:32:29.520 --> 00:32:33.640
So let's build this and
that builds quite happily.
00:32:33.640 --> 00:32:34.540
I'm gonna deploy it.
00:32:35.760 --> 00:32:39.430
So, obviously once we
see the webpage up,
00:32:39.430 --> 00:32:41.390
we know that
everything is running.
00:32:41.390 --> 00:32:46.320
I can then come over to the
emulator and I can say show me
00:32:46.320 --> 00:32:50.580
Microsoft, and that returns me
the value of Microsoft stock.
00:32:50.580 --> 00:32:54.220
So, now we have not only the
ability to just give it a stock
00:32:54.220 --> 00:32:55.410
directly but
00:32:55.410 --> 00:32:59.100
now I can start to give it
natural language capabilities
00:32:59.100 --> 00:33:03.290
by asking in this case, show
me my Microsoft stock, right?
00:33:03.290 --> 00:33:03.930
So that's pretty cool.
00:33:05.490 --> 00:33:09.251
The other intent that we had was
well, show me the stock now.
00:33:09.251 --> 00:33:12.220
And I can ask things like,
how about now?
00:33:13.510 --> 00:33:17.970
And of course we stored
that Microsoft stock ticker
00:33:17.970 --> 00:33:21.990
into the property bag, so now we
get this new message coming in.
00:33:21.990 --> 00:33:24.464
I can obviously query
the property bag,
00:33:24.464 --> 00:33:27.665
pull out the Microsoft
stock ticker, query it, and
00:33:27.665 --> 00:33:29.791
then return that
back to the user.
00:33:29.791 --> 00:33:33.318
So what you've seen just in
the last couple of minutes is
00:33:33.318 --> 00:33:37.071
the ability to easily Integrate
LUIS directly into your bot
00:33:37.071 --> 00:33:40.751
application to add natural
language understanding, but
00:33:40.751 --> 00:33:44.429
also the ability to persist
data across messages from your
00:33:44.429 --> 00:33:46.190
stateless bot.
00:33:46.190 --> 00:33:47.930
So that's pretty neat.
00:33:47.930 --> 00:33:50.123
Okay, Dan, I think the next
thing we need to do is to
00:33:50.123 --> 00:33:51.308
get this thing published.
00:33:51.308 --> 00:33:52.074
>> That's right.
00:33:52.074 --> 00:33:54.722
[CROSSTALK]
>> Why don't you walk us through
00:33:54.722 --> 00:33:56.050
that part of it?
00:33:56.050 --> 00:33:59.270
And then once you've done
that I'll come back and
00:33:59.270 --> 00:34:00.790
we'll add some more code.
00:34:00.790 --> 00:34:03.820
>> Absolutely, so if we could
just flip really quickly back
00:34:03.820 --> 00:34:06.020
to, where's the button to
flip us back to the slides?
00:34:06.020 --> 00:34:06.590
>> The slides?
00:34:06.590 --> 00:34:11.670
>> Yes, you've got it,
good, perfect.
00:34:11.670 --> 00:34:14.520
So we started from
a Visual Studio template and
00:34:14.520 --> 00:34:15.460
having no code.
00:34:15.460 --> 00:34:17.920
We built a simple stock bot,
we've added LUIS.
00:34:17.920 --> 00:34:20.860
And now we have to publish our
bot so it's available to users.
00:34:20.860 --> 00:34:22.030
Connect it up to those users,
and
00:34:22.030 --> 00:34:23.490
then I'm gonna hand
it back to Mike,
00:34:23.490 --> 00:34:25.443
to finish up with
some dialog smarts.
00:34:25.443 --> 00:34:27.217
Six, right here.
00:34:27.217 --> 00:34:29.593
>> Six.
>> Yep, perfect.
00:34:31.380 --> 00:34:34.852
Now, the Microsoft Bot Framework
is an open platform.
00:34:34.852 --> 00:34:37.421
And it's a system that allows
you to bring your own tools,
00:34:37.421 --> 00:34:39.466
bring your own bot,
bring your own, really,
00:34:39.466 --> 00:34:42.351
whatever you'd like, and we have
other tools and resources that
00:34:42.351 --> 00:34:45.400
can be integrated, so that
you can build a complete bot.
00:34:45.400 --> 00:34:47.430
And if you have your
own hosting already,
00:34:47.430 --> 00:34:48.450
you can use your own hosting.
00:34:48.450 --> 00:34:50.910
If you wanna host
your bot on AWS or
00:34:50.910 --> 00:34:53.170
in your own data center or
on Azure, all of those are okay.
00:34:53.170 --> 00:34:55.150
All we need is the end point.
00:34:55.150 --> 00:34:57.830
But in this case, it turns out
that the Azure free trial has
00:34:57.830 --> 00:34:59.630
more than enough space for
us to run our bot.
00:34:59.630 --> 00:35:02.510
And so we're gonna show
you how to use Azure
00:35:02.510 --> 00:35:04.659
to host your bot and
hook it up to the bot framework.
00:35:05.680 --> 00:35:07.220
And I've already got a lot
of this preconfigured.
00:35:07.220 --> 00:35:09.520
We've done the sign up for
Azure.
00:35:09.520 --> 00:35:12.760
All we have to do is
start the publish wizard
00:35:12.760 --> 00:35:14.900
inside of Visual Studio by right
clicking on the project and
00:35:14.900 --> 00:35:16.330
clicking Publish.
00:35:16.330 --> 00:35:18.815
We then select Azure.
00:35:18.815 --> 00:35:20.312
It wants me to reenter.
00:35:20.312 --> 00:35:21.775
That's fine.
00:35:25.199 --> 00:35:26.221
There.
00:35:29.019 --> 00:35:31.120
Okay, much better, so
there's my subscription.
00:35:31.120 --> 00:35:32.073
I have a resource group.
00:35:32.073 --> 00:35:35.476
I'm gonna publish it to
an existing web app that I
00:35:35.476 --> 00:35:37.390
already defined in Azure.
00:35:37.390 --> 00:35:40.502
And the wizard then adds a few
more details about where
00:35:40.502 --> 00:35:44.099
the bot's going to go, what kind
of configuration I want when
00:35:44.099 --> 00:35:46.380
the code's going to
be available, and
00:35:46.380 --> 00:35:48.320
I'll click Publish.
00:35:48.320 --> 00:35:51.080
And in the background, Visual
Studio is compiling my project
00:35:51.080 --> 00:35:53.500
and uploading it and
making my bot available online.
00:35:54.790 --> 00:35:56.860
Now having our bot
online is great, but
00:35:56.860 --> 00:35:59.120
we actually need to register
it with the bot framework so
00:35:59.120 --> 00:36:00.630
that users can talk with it.
00:36:00.630 --> 00:36:03.380
So as this publishes, I'm going
to open up the bot framework.
00:36:04.430 --> 00:36:06.560
Actually it opened up the bot
webpage for me, so that's good.
00:36:06.560 --> 00:36:08.980
We can see that's going to
be live here in a second.
00:36:08.980 --> 00:36:12.040
But then I'll just navigate
to dev.botframework.com
00:36:12.040 --> 00:36:15.090
which is our developer portal
in the Microsoft Bot Framework.
00:36:16.470 --> 00:36:18.041
I should be signed in already.
00:36:18.041 --> 00:36:19.296
This is good.
00:36:19.296 --> 00:36:22.163
And you can see that
there's a list of bots.
00:36:22.163 --> 00:36:24.462
Here's the Domino's Pizza Bot
that I demoed earlier.
00:36:24.462 --> 00:36:26.970
But we're gonna
register a new bot.
00:36:26.970 --> 00:36:27.940
So we're gonna register a bot,
00:36:27.940 --> 00:36:32.560
we'll call it the StockBot,
we'll give it a description.
00:36:32.560 --> 00:36:36.620
This is not a bot that's
gonna hock your stocks.
00:36:36.620 --> 00:36:43.514
We'll give it our endpoint,
which is secure by HTTPS,
00:36:43.514 --> 00:36:48.219
api/messages, and
a mic with this.
00:36:49.500 --> 00:36:55.250
We have our privacy URL here so
that our users know how
00:36:55.250 --> 00:36:59.530
my bot is going to retain data
which in this case it doesn't.
00:36:59.530 --> 00:37:01.600
We have fields where we can
add a telemetry key if we have
00:37:01.600 --> 00:37:05.580
that available, add in the bot
website which we are not,
00:37:05.580 --> 00:37:07.410
we're gonna leave that blank for
now.
00:37:07.410 --> 00:37:10.140
And here are some options where
we can have our bot translate
00:37:10.140 --> 00:37:12.790
all messages, which we'll leave
enabled in case someone wants to
00:37:12.790 --> 00:37:14.480
talk in a language
other than English.
00:37:14.480 --> 00:37:17.370
Publish in the bot directory,
which we'll just leave false.
00:37:17.370 --> 00:37:18.434
So we'll give this an ID.
00:37:18.434 --> 00:37:23.738
We'll call it BuildaStockBot.
00:37:23.738 --> 00:37:26.176
So I doubt that ID is taken.
00:37:29.241 --> 00:37:33.119
And then, click Register and
we'll see.
00:37:33.119 --> 00:37:36.290
We'll see if anyone has beat
me to that ID in the last 30
00:37:36.290 --> 00:37:36.904
seconds.
00:37:36.904 --> 00:37:37.497
No they haven't.
00:37:37.497 --> 00:37:39.536
All right, so
our bot has been created and
00:37:39.536 --> 00:37:42.566
is now registered with the bot
framework, now I'm gonna call
00:37:42.566 --> 00:37:45.270
your attention to
the panel on the left here.
00:37:45.270 --> 00:37:48.230
Remember earlier in our web
config we had slots for an app
00:37:48.230 --> 00:37:50.870
ID and app secret and here's
where you get that information.
00:37:50.870 --> 00:37:52.430
Here's the app ID which
we chose earlier.
00:37:52.430 --> 00:37:55.400
And then here's our app
secret which we'll copy and
00:37:55.400 --> 00:37:56.560
paste in a minute.
00:37:56.560 --> 00:37:58.870
Then we have a few
settings that we set.
00:37:58.870 --> 00:38:02.030
And then down here on the left
we have a panel where we can
00:38:02.030 --> 00:38:04.020
actually test
the connection to our bot.
00:38:04.020 --> 00:38:06.983
And I can tell you right now
that this is gonna fail because
00:38:06.983 --> 00:38:09.886
the bot framework is going to
authorize itself to our bot
00:38:09.886 --> 00:38:11.245
using different app ID and
00:38:11.245 --> 00:38:13.439
app secret than what
we have configured.
00:38:13.439 --> 00:38:16.735
So it'll take a second for
the site to spool up, but
00:38:16.735 --> 00:38:20.046
this will very likely give
me a permissions error.
00:38:20.046 --> 00:38:21.000
I don't even think
I gotta wait for
00:38:21.000 --> 00:38:23.100
that to come back,
cuz I know it's gonna fail.
00:38:23.100 --> 00:38:24.112
So what I'm gonna do now is,
00:38:24.112 --> 00:38:25.506
I'm gonna take the app
ID app secrets,
00:38:25.506 --> 00:38:26.990
we're gonna build a stock bot.
00:38:26.990 --> 00:38:28.750
And here's our app secret.
00:38:28.750 --> 00:38:30.630
As a developer, you would
usually keep this to yourself.
00:38:30.630 --> 00:38:32.150
We'll keep this to ourselves.
00:38:32.150 --> 00:38:34.070
You and me, Mike, and
everyone in the room, and
00:38:34.070 --> 00:38:34.860
streaming online.
00:38:36.220 --> 00:38:38.391
If anyone wants to
impersonate our StockBot,
00:38:38.391 --> 00:38:40.628
knows what the credentials
guarantee will be.
00:38:40.628 --> 00:38:42.986
We'll take those down
once we're done.
00:38:42.986 --> 00:38:44.367
BuildAStockBot.
00:38:47.710 --> 00:38:49.120
And we'll paste in
our app secret.
00:38:51.730 --> 00:38:54.120
And then we will
publish our bot, again,
00:38:54.120 --> 00:38:55.040
with these new settings.
00:39:02.440 --> 00:39:06.550
And this will take a second,
but once our bot is online,
00:39:06.550 --> 00:39:10.937
it will be ready to accept
messages from the bot framework.
00:39:10.937 --> 00:39:13.119
So, let me try that again.
00:39:13.119 --> 00:39:17.210
And we'll send it a test message
just to make sure it's working.
00:39:17.210 --> 00:39:18.850
As the service gets pulled up,
00:39:18.850 --> 00:39:21.120
we'll talk about
the pane on the right.
00:39:21.120 --> 00:39:22.830
So, on the right-hand
side of the dashboard,
00:39:22.830 --> 00:39:25.430
you can see all of the channels
where you can connect your bot.
00:39:25.430 --> 00:39:26.950
You can connect your
bot to services,
00:39:26.950 --> 00:39:28.430
like I mentioned before,
Skype, Slack,
00:39:28.430 --> 00:39:30.840
SMS, Telegram, Group Meeting.
00:39:30.840 --> 00:39:34.100
In this example we're
going to show you Slack.
00:39:34.100 --> 00:39:37.190
Now all of our channels are a
bring your own account model.
00:39:37.190 --> 00:39:39.690
So you sign up for each of
these services on your own.
00:39:39.690 --> 00:39:41.640
You take your username and
password for them and you give
00:39:41.640 --> 00:39:44.010
them to the bot framework
which stores them encrypted.
00:39:44.010 --> 00:39:46.710
But it allows us to communicate
on behalf of your bot.
00:39:46.710 --> 00:39:48.850
And what that means is that if
you already have an account for
00:39:48.850 --> 00:39:50.160
your bot,
you can just bring it in.
00:39:50.160 --> 00:39:51.680
You don't have to
register a new one.
00:39:51.680 --> 00:39:52.220
And later on,
00:39:52.220 --> 00:39:54.500
if you want to take control of
that account again, it's yours.
00:39:54.500 --> 00:39:57.413
And you just have to deauthorize
it from the bot framework
00:39:57.413 --> 00:39:58.450
developer portal.
00:39:58.450 --> 00:39:59.627
Let's get the process started.
00:39:59.627 --> 00:40:00.844
I'm gonna click on Add.
00:40:00.844 --> 00:40:04.795
And the bot framework gives us
all of the steps to add our bot
00:40:04.795 --> 00:40:05.526
to Slack.
00:40:05.526 --> 00:40:08.230
So we open up the first
slider here and
00:40:08.230 --> 00:40:10.680
it says go to this
thing in Slack.
00:40:11.820 --> 00:40:16.690
And we're going to give
it a set of names here,
00:40:16.690 --> 00:40:18.590
Slack wants a pretty
good description.
00:40:19.740 --> 00:40:22.400
So we'll put in
some descriptions.
00:40:22.400 --> 00:40:25.730
And at this point we
have a few fields that
00:40:25.730 --> 00:40:27.440
we're gonna need some help with.
00:40:27.440 --> 00:40:29.690
Now the bot framework actually
gives us these fields.
00:40:29.690 --> 00:40:31.430
It says in the redirect URI,
00:40:31.430 --> 00:40:33.780
we'd like to copy
the text from below.
00:40:33.780 --> 00:40:37.230
So we'll copy that and
paste it in over here.
00:40:37.230 --> 00:40:39.480
And I've done this
a few times already, so
00:40:39.480 --> 00:40:41.230
I know we just click
the Create Application button.
00:40:42.700 --> 00:40:44.070
And now,
going into the next section,
00:40:44.070 --> 00:40:47.700
it says scroll down the page and
click Add a Bot User.
00:40:47.700 --> 00:40:48.850
So we'll do that.
00:40:48.850 --> 00:40:52.390
So you can see the screenshot
matches here, it's easy to find.
00:40:52.390 --> 00:40:54.730
We will call it Stock Bot and
we'll click Add Bot User.
00:40:54.730 --> 00:40:58.150
And then it says scroll back
up to the top and copy and
00:40:58.150 --> 00:41:01.010
paste these values
into the Bot framework.
00:41:02.860 --> 00:41:04.635
There we go, there's that.
00:41:07.160 --> 00:41:08.810
And we'll click Submit.
00:41:08.810 --> 00:41:13.010
Now in the background,
the bot framework is submitting
00:41:13.010 --> 00:41:15.920
our application, it's submitting
our credentials to Slack so
00:41:15.920 --> 00:41:17.030
that we can verify them.
00:41:17.030 --> 00:41:18.440
We'll make sure that
your bot can actually
00:41:18.440 --> 00:41:21.050
communicate with Slack before
we light it up for your bot.
00:41:22.080 --> 00:41:25.700
So we're gonna put this in
the StockBot Rocks Channel.
00:41:25.700 --> 00:41:28.550
It already has one in there.
00:41:28.550 --> 00:41:30.480
We'll just put it in General.
00:41:30.480 --> 00:41:31.540
Click Authorize.
00:41:32.850 --> 00:41:36.090
You notice I may have tried
this out last night, so
00:41:36.090 --> 00:41:37.530
I already have a StockBot
in there, but that's okay.
00:41:37.530 --> 00:41:38.650
And we'll add it
in as StockBot2.
00:41:38.650 --> 00:41:42.190
And at this point, the Bot
Framework has been able to
00:41:42.190 --> 00:41:43.990
successfully communicate
with Slack,
00:41:43.990 --> 00:41:46.830
it's added it to a channel,
and it's all ready to go.
00:41:46.830 --> 00:41:49.740
And so we just go back
to the Bot Framework,
00:41:49.740 --> 00:41:52.860
we say I'm done
configuring Slack, and
00:41:52.860 --> 00:41:56.550
now Slack has been added
on our list of channels.
00:41:56.550 --> 00:42:00.040
This button right here
is a Slack button
00:42:00.040 --> 00:42:02.230
that I can now copy out of
our developing portal and
00:42:02.230 --> 00:42:04.630
put on to my own
webpage if I like.
00:42:04.630 --> 00:42:05.909
Now lets actually
try it out in Slack.
00:42:08.170 --> 00:42:09.600
Now we'll go to build.
00:42:12.040 --> 00:42:13.675
Build a bot at Slack.
00:42:13.675 --> 00:42:15.900
Build a bot at Build.
00:42:15.900 --> 00:42:16.860
And it's in general.
00:42:16.860 --> 00:42:18.050
And so there we have Stock Bot.
00:42:19.810 --> 00:42:21.860
So we may have to
invite our bot in.
00:42:21.860 --> 00:42:24.940
So it's stockbot2, we'll say.
00:42:24.940 --> 00:42:27.324
And so
we will invite them to join.
00:42:33.522 --> 00:42:36.629
How is Microsoft doing?
00:42:39.331 --> 00:42:40.889
And we'll see, and
we'll go over here and
00:42:40.889 --> 00:42:42.720
make sure that actually
our test message worked.
00:42:42.720 --> 00:42:45.238
So our test message worked fine.
00:42:49.283 --> 00:42:51.360
We'll try one more time here.
00:42:59.138 --> 00:43:00.430
Well, we may be under
a lot of load today, but
00:43:00.430 --> 00:43:01.440
that's all right.
00:43:01.440 --> 00:43:03.529
Once you actually added
your bot to Slack,
00:43:03.529 --> 00:43:05.710
you can communicate
with it there.
00:43:05.710 --> 00:43:06.832
And you can add it
to other channels
00:43:06.832 --> 00:43:07.769
like you can see on the left.
00:43:09.250 --> 00:43:11.390
Skype, SMS and others.
00:43:11.390 --> 00:43:13.570
Now at this point we've
connected our bot up to users.
00:43:13.570 --> 00:43:15.360
And so I'm gonna hand
it back off to Mike.
00:43:15.360 --> 00:43:18.110
And Mike is gonna tell you
all about how to add dialog
00:43:18.110 --> 00:43:20.240
smarts to our bot.
00:43:20.240 --> 00:43:21.602
>> Great, thanks Dan.
00:43:24.910 --> 00:43:28.035
Okay, so what we've seen so
far is handling kind of
00:43:28.035 --> 00:43:32.530
bidirectional messaging inside
of our bot application.
00:43:32.530 --> 00:43:35.540
But one of the things that
is quite often gonna happen
00:43:35.540 --> 00:43:37.950
when you're writing something
like a bot application.
00:43:37.950 --> 00:43:41.240
Even if you have a user that
is communicating using natural
00:43:41.240 --> 00:43:44.665
language, you imagine ordering a
pizza like a Domino's Pizza that
00:43:44.665 --> 00:43:46.110
Dan was showing earlier
during the keynote.
00:43:46.110 --> 00:43:48.490
And obviously we got
the pizza right here.
00:43:48.490 --> 00:43:52.060
Is that somebody may leave
off some part of the order.
00:43:52.060 --> 00:43:53.770
Maybe they don't
specify the size,
00:43:53.770 --> 00:43:56.420
maybe they don't specify
the delivery address.
00:43:56.420 --> 00:43:58.620
Maybe there's some pieces
that are missing, right?
00:43:58.620 --> 00:44:01.740
So if you think about
a mobile app or
00:44:01.740 --> 00:44:04.790
you think about a web-based
application, quite often these
00:44:04.790 --> 00:44:08.580
applications will walk you as a
user, through a number of steps
00:44:08.580 --> 00:44:11.990
of in effect a form that needs
to be filled in and have various
00:44:11.990 --> 00:44:15.540
fields completed in order for
that order to be complete.
00:44:15.540 --> 00:44:18.910
Right, so if we then think
about mixing natural language
00:44:18.910 --> 00:44:23.340
processing to pull out all
of the entities required for
00:44:23.340 --> 00:44:24.540
ordering something like a pizza.
00:44:24.540 --> 00:44:27.530
It could well be that some
of those fields are missing.
00:44:27.530 --> 00:44:30.470
In which case, we can actually
prompt the user as part
00:44:30.470 --> 00:44:34.210
of a dialogue or form model for
them to fill in the remaining
00:44:34.210 --> 00:44:37.590
parts of that form in order for
that dialogue to be complete.
00:44:38.710 --> 00:44:43.569
Okay, so one thing that I
need to do obviously since
00:44:43.569 --> 00:44:46.620
Dan has now modified
the keys for
00:44:46.620 --> 00:44:52.164
this application is get the app
ID out of the Web.config.
00:44:52.164 --> 00:44:58.767
Go to the emulator and
paste that app ID in and
00:44:58.767 --> 00:45:02.710
also grab the app secret.
00:45:02.710 --> 00:45:06.130
And go to the emulator and
replace that as well.
00:45:07.240 --> 00:45:07.990
Okay, good.
00:45:07.990 --> 00:45:11.660
So, now, when we make changes to
our bot, it should still be able
00:45:11.660 --> 00:45:14.631
to communicate through
the emulator to the bot.
00:45:16.090 --> 00:45:16.794
Right, so
00:45:16.794 --> 00:45:20.878
now what I'm gonna do is add a
new class into the application.
00:45:20.878 --> 00:45:21.910
Add > Class.
00:45:21.910 --> 00:45:26.380
I'm gonna call this stock, and
what I'm going to do is now
00:45:26.380 --> 00:45:30.930
paste in some code, or
very quickly type some code,
00:45:30.930 --> 00:45:34.510
which is going to provide, in
effect, the outline of this form
00:45:34.510 --> 00:45:36.740
that we're gonna have
the user fill in.
00:45:36.740 --> 00:45:38.020
So for buying or
00:45:38.020 --> 00:45:41.940
selling stock, we probably
want the stock ticker.
00:45:41.940 --> 00:45:45.240
We want to determine whether
the user wants to buy or sell.
00:45:45.240 --> 00:45:48.160
We want to determine how
many shares and the date or
00:45:48.160 --> 00:45:52.370
time that the user wants to
buy or sell those shares.
00:45:52.370 --> 00:45:55.090
You'll notice that I've
got FormBuilder with
00:45:55.090 --> 00:45:57.960
the red squiggly underneath it
which means something's missing.
00:45:57.960 --> 00:46:02.390
So what I need to do is add
an additional NuGet package to
00:46:02.390 --> 00:46:07.850
the application which is
called Microsoft Bot Builder.
00:46:07.850 --> 00:46:12.500
And this is a NuGet package that
brings in support for forms and
00:46:12.500 --> 00:46:14.480
dialogues into your application.
00:46:15.800 --> 00:46:18.070
Now, one of the things that
we'll see when we go back to
00:46:18.070 --> 00:46:23.630
the code, is there are two parts
to adding the form support in.
00:46:23.630 --> 00:46:26.220
The first part inside of
our stock application,
00:46:26.220 --> 00:46:29.670
our stock class,
is to define the form.
00:46:29.670 --> 00:46:31.180
And that comes in two stages,
00:46:31.180 --> 00:46:34.180
the first of which is the fields
that we see down here,
00:46:34.180 --> 00:46:36.290
stock ticker, buy, sell, number
of shares, and order date.
00:46:36.290 --> 00:46:40.960
The second part is to generate
the form and return it
00:46:40.960 --> 00:46:44.920
back to the dialogue handler
inside of our application.
00:46:44.920 --> 00:46:48.470
So if you are familiar with,
say GDI programming.
00:46:48.470 --> 00:46:50.780
Creating a dialog and
then having the resources for
00:46:50.780 --> 00:46:53.000
that dialog,
two separate pieces, right?
00:46:53.000 --> 00:46:55.010
So in effect,
this is the same model here.
00:46:55.010 --> 00:46:58.600
You define your form, and
then you build the form and
00:46:58.600 --> 00:47:01.260
return it back to
the dialog handler.
00:47:01.260 --> 00:47:05.190
So here is the piece of code
inside of our class that
00:47:05.190 --> 00:47:06.840
generates the form and
returns it back.
00:47:06.840 --> 00:47:08.910
There are a couple of things
that we want to point out.
00:47:08.910 --> 00:47:12.950
The first of which is when a
user first connects to the bot,
00:47:12.950 --> 00:47:15.960
using form filling, we'll return
a message back to the user.
00:47:17.070 --> 00:47:20.950
This .addRemainingFields, you
notice there's nothing before
00:47:20.950 --> 00:47:22.060
it, apart from
the welcome message.
00:47:22.060 --> 00:47:24.440
Well, actually, you'll see
that change in a second, but
00:47:24.440 --> 00:47:27.700
in effect, what's happening is,
we're adding in all these fields
00:47:27.700 --> 00:47:30.180
into the form, and
then we say, build the form.
00:47:30.180 --> 00:47:33.510
So, we're gonna come back to
this class in just a second.
00:47:33.510 --> 00:47:38.060
But what I'm gonna do first
is grab all of the code,
00:47:38.060 --> 00:47:42.660
that sits here all the way
through to HandleSystemMessage.
00:47:42.660 --> 00:47:47.110
And I'm gonna replace that with
a piece of code that obviously
00:47:47.110 --> 00:47:50.369
looks a lot simpler than the
Lewis code that we had before.
00:47:51.390 --> 00:47:54.850
I need to add in a couple of
additional usings here as well.
00:47:56.010 --> 00:47:58.250
And here as well.
00:48:00.520 --> 00:48:02.700
So this is where the dialogue
comes in, right?
00:48:02.700 --> 00:48:07.810
So this dialogue is form
dialogue from form and
00:48:07.810 --> 00:48:10.090
then the StockOrder.MakeForm.
00:48:10.090 --> 00:48:12.620
So that's where the form
information gets built into
00:48:12.620 --> 00:48:15.340
the dialogue and then the dialog
is handled with the user.
00:48:16.520 --> 00:48:22.223
So what I'm gonna do is
build that, run that.
00:48:22.223 --> 00:48:22.790
And again,
00:48:22.790 --> 00:48:25.920
we should see the standard
webpage being displayed.
00:48:25.920 --> 00:48:28.560
And now if I come back to the
emulator, because we've changed
00:48:28.560 --> 00:48:32.120
the appId and appSecret,
I should now be able to type,
00:48:32.120 --> 00:48:35.720
hello and it says,
Welcome to Stock Bot!
00:48:35.720 --> 00:48:37.880
Please enter stock ticker,
right?
00:48:37.880 --> 00:48:38.980
So now we're into the form,
00:48:38.980 --> 00:48:41.050
there are a number of
things that I can type.
00:48:41.050 --> 00:48:43.340
I can type help or
00:48:43.340 --> 00:48:47.200
status, which shows me how much
of the form is already complete.
00:48:47.200 --> 00:48:49.910
Obviously, if I add
the Lewis model into this
00:48:49.910 --> 00:48:53.300
then we could use Lewis to
pull out the various pieces of
00:48:53.300 --> 00:48:55.060
the user's intent.
00:48:55.060 --> 00:48:58.590
Autofill some of the fields
within that form and only prompt
00:48:58.590 --> 00:49:01.030
the user for the pieces that
are missing, all right?
00:49:02.130 --> 00:49:05.720
Okay, so what I'm gonna
do obviously is put in my
00:49:05.720 --> 00:49:08.500
favorite ticker that
we saw earlier, right?
00:49:08.500 --> 00:49:11.010
I'm gonna hit Enter and
it seems quite happy with that.
00:49:11.010 --> 00:49:13.470
So now we appear to be missing
00:49:13.470 --> 00:49:15.930
a piece of functionality
that we had before.
00:49:15.930 --> 00:49:19.180
Which was the ability to call
out to that Yahoo stock service.
00:49:19.180 --> 00:49:22.000
Validate the stock, and
then return to the user saying,
00:49:22.000 --> 00:49:25.520
this doesn't appear to be valid,
or this is valid stock.
00:49:25.520 --> 00:49:29.110
The other thing that we're
seeing in this conversation, is,
00:49:29.110 --> 00:49:29.960
if we have a look here.
00:49:29.960 --> 00:49:32.630
It says,
please enter stock ticker.
00:49:32.630 --> 00:49:34.320
If we come back to
our application and
00:49:34.320 --> 00:49:36.350
have a look in stock.cs.
00:49:36.350 --> 00:49:39.380
You'll see that this is
the name of the field,
00:49:39.380 --> 00:49:41.120
that's on the form, right?
00:49:41.120 --> 00:49:44.580
What we might want to do
is change this to provide,
00:49:44.580 --> 00:49:47.450
rather than the name of
the element within form,
00:49:47.450 --> 00:49:49.360
something more
descriptive to the user.
00:49:50.360 --> 00:49:56.405
So, what I'm going to do is come
back to this piece of code.
00:49:56.405 --> 00:50:00.703
I'm going to replace that, and
the top of this is identical to
00:50:00.703 --> 00:50:05.085
what we had before But what I'm
now adding is some annotation on
00:50:05.085 --> 00:50:08.680
the various fields that
are inside of this class.
00:50:08.680 --> 00:50:10.660
So you can see here
there's a prompt that says
00:50:10.660 --> 00:50:13.490
Which Stock Ticker
are you interested in?
00:50:13.490 --> 00:50:16.150
And then, the Stock Ticker.
00:50:16.150 --> 00:50:18.155
Do you want to Buy or Sell?
00:50:18.155 --> 00:50:19.962
And so on right.
00:50:19.962 --> 00:50:23.480
So now if I build this,
deploy this.
00:50:23.480 --> 00:50:27.340
Again, we get the standard
web page being displayed.
00:50:27.340 --> 00:50:29.980
I'm just going to close
that down as well,
00:50:29.980 --> 00:50:33.620
come back to the emulator,
say hello.
00:50:33.620 --> 00:50:36.680
And now,
rather than the names of,
00:50:36.680 --> 00:50:40.530
let me just try that again,
gonna shut down the emulator for
00:50:40.530 --> 00:50:43.440
just a second to restart
the conversation from scratch.
00:50:44.570 --> 00:50:47.300
What we'll see is when
the emulator restarts and
00:50:47.300 --> 00:50:51.220
I interact with that emulator
and I say hello, what we should
00:50:51.220 --> 00:50:57.650
see is that instead of the name
of the field inside of the class
00:50:57.650 --> 00:51:00.830
being displayed to me, I'll
actually get the full prompt for
00:51:00.830 --> 00:51:04.800
what we see here inside
of the stock class.
00:51:04.800 --> 00:51:08.475
Okay, so let's go back and
say hello.
00:51:10.699 --> 00:51:11.763
Welcome to Stock Bot,
00:51:11.763 --> 00:51:14.480
which Stock Ticker
are you interested in?
00:51:14.480 --> 00:51:16.740
Okay, so I could obviously
enter something like Microsoft,
00:51:16.740 --> 00:51:19.160
or I could put in my
favorite stock tickers.
00:51:19.160 --> 00:51:21.920
Let's do that again, right,
and I'm gonna type that in.
00:51:21.920 --> 00:51:25.340
Hit Enter, and again, it's
still really not doing anything
00:51:25.340 --> 00:51:26.970
about validating that stock.
00:51:26.970 --> 00:51:29.900
I can obviously navigate
within the form as well.
00:51:29.900 --> 00:51:34.424
So this is taking me from stock,
down to whether I want to buy or
00:51:34.424 --> 00:51:37.991
sell and I can either type
the word buy or sell, or
00:51:37.991 --> 00:51:40.081
I can add the number 1 or 2.
00:51:40.081 --> 00:51:42.947
There's some built in validation
here, so if I try and type 3,
00:51:42.947 --> 00:51:45.180
it tells me that
that's not an option.
00:51:45.180 --> 00:51:47.290
If I get to a date and
time field and
00:51:47.290 --> 00:51:49.950
I try and enter a date and
time that is not valid, again,
00:51:49.950 --> 00:51:53.130
that will be validated for
me as part of the form.
00:51:53.130 --> 00:51:55.922
If I want to go back and
fix up that stock item,
00:51:55.922 --> 00:51:59.166
I can type back, which will
take me back in the form.
00:51:59.166 --> 00:52:02.990
And obviously, I could correct
this and put in a valid ticker.
00:52:02.990 --> 00:52:07.544
But we still want to be able to
get to that point that I can
00:52:07.544 --> 00:52:12.098
validate the stock on the fly
as the user is interacting
00:52:12.098 --> 00:52:13.981
with my form, right?
00:52:13.981 --> 00:52:15.805
Yes, I hear you say.
00:52:15.805 --> 00:52:19.650
Yeah, great, okay, so
why don't we fix that up now?
00:52:19.650 --> 00:52:24.190
What I'm gonna do is come
back into the class, and
00:52:24.190 --> 00:52:27.050
I'm gonna replace
this with the exact
00:52:27.050 --> 00:52:29.480
piece of code that we had before
down at the bottom, right?
00:52:29.480 --> 00:52:32.382
So this is the fields
that make up the form.
00:52:32.382 --> 00:52:36.106
But if we come back up, we'll
notice that the piece of code
00:52:36.106 --> 00:52:38.800
that builds the form
is now changed.
00:52:38.800 --> 00:52:42.340
We still start off with
Form Builder to build the form.
00:52:42.340 --> 00:52:45.300
We have our welcome message,
Welcome to the Stock Bot!
00:52:45.300 --> 00:52:47.320
I then add one of the fields, so
00:52:47.320 --> 00:52:52.030
I can now set the order of the
fields within the form, right?
00:52:52.030 --> 00:52:55.213
But rather than just
adding the field,
00:52:55.213 --> 00:52:59.273
I'm also kicking into
a validate function here.
00:52:59.273 --> 00:53:02.174
And in this case I'm generating
a validate result, and
00:53:02.174 --> 00:53:03.990
this has two parts to it.
00:53:03.990 --> 00:53:06.190
A IsValid true or false.
00:53:06.190 --> 00:53:09.570
So I can determine or
return back into the form model
00:53:09.570 --> 00:53:12.550
that this field is now complete,
we're good to move on.
00:53:12.550 --> 00:53:15.720
Right, so I return true to say
that this field within the form
00:53:15.720 --> 00:53:17.370
is correct.
00:53:17.370 --> 00:53:20.280
Or I can return false to say
nope, that was incorrect.
00:53:20.280 --> 00:53:22.060
I now need you to
reenter some data.
00:53:23.280 --> 00:53:25.751
So this will obviously
be very familiar to you.
00:53:25.751 --> 00:53:28.391
I'm calling out to the Yahoo
stock service with
00:53:28.391 --> 00:53:31.020
the value that
the user has entered.
00:53:31.020 --> 00:53:34.030
If it's null,
then I return a string saying,
00:53:34.030 --> 00:53:38.390
that's not valid, and set the
return IsValid field to false.
00:53:38.390 --> 00:53:39.640
Otherwise, if it is valid,
00:53:39.640 --> 00:53:43.060
I will return to the user
saying, okay, that's valid.
00:53:43.060 --> 00:53:45.390
Here's what the stock
is currently at.
00:53:45.390 --> 00:53:47.060
And then move on to
the next field in the form.
00:53:49.220 --> 00:53:52.220
And then we add
the rest of the fields.
00:53:52.220 --> 00:53:54.701
There are a couple of other
interesting things that we
00:53:54.701 --> 00:53:55.202
see here.
00:53:55.202 --> 00:53:57.530
First of all,
I've added a .Confirm.
00:53:57.530 --> 00:54:00.380
So whenever the form
is filled correctly,
00:54:00.380 --> 00:54:04.960
all the fields are valid, we
can then prompt a user to say,
00:54:04.960 --> 00:54:08.600
do you want to order,
buy, sell so
00:54:08.600 --> 00:54:12.390
many shares in
a stock right now?
00:54:12.390 --> 00:54:14.260
And that'll prompt
the user to say yes or no,
00:54:14.260 --> 00:54:15.570
that they want to continue.
00:54:16.570 --> 00:54:19.773
The other thing that we
have is an OnCompletion.
00:54:19.773 --> 00:54:22.604
I just need to fix up
this Debug.WriteLine, and
00:54:22.604 --> 00:54:25.165
maybe we'll set a break
point here as well.
00:54:25.165 --> 00:54:28.637
So this gives you the ability,
obviously if you're writing
00:54:28.637 --> 00:54:31.971
a real bot, when somebody is
filling a form, once the form
00:54:31.971 --> 00:54:35.442
is complete, once you know that
it's complete you probably
00:54:35.442 --> 00:54:38.912
want to kick off into your own
corporate model for initiating
00:54:38.912 --> 00:54:42.300
some kind of event or storing
some data or whatever else.
00:54:42.300 --> 00:54:44.940
So this is the place
that you would do that.
00:54:44.940 --> 00:54:47.890
Okay, so now let's go ahead and
00:54:47.890 --> 00:54:52.450
build that as the bot
application, deploy it.
00:54:52.450 --> 00:54:56.310
Again, we'll see the standard
webpage being displayed.
00:54:56.310 --> 00:54:59.610
And the next thing we want to do
is go back to the emulator and
00:54:59.610 --> 00:55:00.510
say hello.
00:55:02.704 --> 00:55:05.953
Well, obviously, we're still
in the conversation, so
00:55:05.953 --> 00:55:10.230
I'm just going to tear that down
and bring the emulator back up.
00:55:10.230 --> 00:55:12.460
So, what's gonna happen
when the emulator starts?
00:55:12.460 --> 00:55:15.580
I'm gonna initiate
the conversation, say hi, right?
00:55:15.580 --> 00:55:19.630
Once I say that, we'll step into
the form and the first item
00:55:19.630 --> 00:55:22.260
that we have within the form
is to fill out the stock.
00:55:22.260 --> 00:55:25.070
So I can then give it
obviously my favorite ticker.
00:55:25.070 --> 00:55:26.190
Jigger jigger jigger.
00:55:26.190 --> 00:55:27.980
And hopefully that's
gonna come back and
00:55:27.980 --> 00:55:29.220
say no that's not valid.
00:55:29.220 --> 00:55:31.820
You need to re-enter
your stock and
00:55:31.820 --> 00:55:34.360
then we can add
a real stock ticker.
00:55:34.360 --> 00:55:36.499
So let's say hello.
00:55:36.499 --> 00:55:37.404
Welcome to Stock Bot,
00:55:37.404 --> 00:55:39.124
which Stock Ticker
are you interested in?
00:55:39.124 --> 00:55:43.680
So we get the fuller version
of the prompt there.
00:55:43.680 --> 00:55:45.728
And I'll enter an invalid stock,
and
00:55:45.728 --> 00:55:47.907
it says this is not
a valid stock ticker.
00:55:47.907 --> 00:55:51.883
So, our validate function is now
being hit in line within that
00:55:51.883 --> 00:55:52.884
form, right?
00:55:52.884 --> 00:55:55.928
So now if I enter a valid stock,
it will say it's currently at
00:55:55.928 --> 00:55:57.970
this amount,
do you want to Buy or Sell?
00:55:57.970 --> 00:56:00.097
So I'll say buy some number.
00:56:00.097 --> 00:56:01.922
On what date do you want
this to take place?
00:56:01.922 --> 00:56:05.990
We'll say 3/30/2016 which
should be a valid date.
00:56:05.990 --> 00:56:06.695
How many shares?
00:56:06.695 --> 00:56:07.555
Let' say 100.
00:56:07.555 --> 00:56:10.700
And then,
we get that .Confirm firing.
00:56:10.700 --> 00:56:15.230
Do you want to buy 100 shares
of Microsoft on this date?
00:56:15.230 --> 00:56:18.806
So, if we say, yes, then, at
that point, our breakpoint fires
00:56:18.806 --> 00:56:21.473
in the bot, and, obviously,
we can do whatever
00:56:21.473 --> 00:56:24.813
we want at that point with the
data that's part of that form.
00:56:24.813 --> 00:56:28.348
All right, so
that's pretty neat, right?
00:56:28.348 --> 00:56:34.346
>> [APPLAUSE]
>> So,
00:56:34.346 --> 00:56:37.317
we have just a couple of minutes
remaining in this session.
00:56:37.317 --> 00:56:41.454
And what we've seen during the
last 60 minutes is we've taken
00:56:41.454 --> 00:56:45.438
you through the model of File >
New Project to get to a template
00:56:45.438 --> 00:56:46.970
for a bot application,
00:56:46.970 --> 00:56:50.990
through to dealing with both
user and system messages.
00:56:50.990 --> 00:56:54.540
And then on top of that,
adding natural language handling
00:56:54.540 --> 00:56:58.990
through LUIS, as well as
form filling and validation
00:56:58.990 --> 00:57:03.500
of items within a form inside
of your bot application, right.
00:57:03.500 --> 00:57:07.380
Obviously, you can mix all of
these various pieces together,
00:57:07.380 --> 00:57:10.320
a mixture of LUIS and
dialogs and forms and
00:57:10.320 --> 00:57:12.400
cascading forms and prompts.
00:57:12.400 --> 00:57:14.010
There's a lot that we
haven't shown you that
00:57:14.010 --> 00:57:17.410
you can obviously go take
a look at after this session.
00:57:17.410 --> 00:57:20.270
Okay, great, so
I think we've covered a lot.
00:57:20.270 --> 00:57:21.685
Dan, anything else to say?
00:57:21.685 --> 00:57:22.670
>> Absolutely,
00:57:22.670 --> 00:57:25.460
I mentioned earlier that the bot
framework is an open platform.
00:57:25.460 --> 00:57:27.570
And you can compose any of the
tools that you already have with
00:57:27.570 --> 00:57:29.060
the tools that we've
shown you here.
00:57:29.060 --> 00:57:30.750
As long as they talk
our message format, or
00:57:30.750 --> 00:57:32.570
if you wanna use our
bot builder framework.
00:57:32.570 --> 00:57:36.415
We have a lot that you can use.
00:57:36.415 --> 00:57:40.586
And so if you wanna build your
own bot, actually if you wanna
00:57:40.586 --> 00:57:45.008
use regexes, if you wanna use
your own state management code,
00:57:45.008 --> 00:57:47.270
you can do that and it's great.
00:57:47.270 --> 00:57:50.050
You can put together
big stacks of regexes,
00:57:50.050 --> 00:57:52.680
you can add all that
into your own bot.
00:57:52.680 --> 00:57:54.220
But I like being
able to use LUIS,
00:57:54.220 --> 00:57:57.170
I like being able to use the
form stuff because it reduces so
00:57:57.170 --> 00:57:58.130
much complexity in the code.
00:57:59.300 --> 00:58:01.242
So we have a few resources for
you.
00:58:01.242 --> 00:58:03.243
Go to botframework.com
to download the SDK,
00:58:03.243 --> 00:58:04.660
download our emulator.
00:58:04.660 --> 00:58:07.190
Actually use the bot connector
to connect your bot up
00:58:07.190 --> 00:58:08.730
to your users.
00:58:08.730 --> 00:58:11.953
We have a quick start challenge
in the main hub of the event
00:58:11.953 --> 00:58:14.773
hall, where you can use
some additional tools for
00:58:14.773 --> 00:58:15.931
the bot framework.
00:58:15.931 --> 00:58:19.051
We have a QnA Maker that the
folks from Bing put together,
00:58:19.051 --> 00:58:21.781
where you can build a bot
with really very little or
00:58:21.781 --> 00:58:23.418
almost no source code at all.
00:58:23.418 --> 00:58:24.591
You point it to a web page and
00:58:24.591 --> 00:58:26.631
it builds an interactive
bot from that page, so
00:58:26.631 --> 00:58:27.959
go over there and try that out.
00:58:27.959 --> 00:58:30.003
And then there are a ton of
other sections, and in fact,
00:58:30.003 --> 00:58:31.057
I didn't have enough room.
00:58:31.057 --> 00:58:33.184
I listed three of them,
there are so many more.
00:58:33.184 --> 00:58:36.972
There's a session on Building
a Skype Bot directly to
00:58:36.972 --> 00:58:38.071
the Skype SDK.
00:58:38.071 --> 00:58:40.944
There's another session that
Mike's gonna have on building
00:58:40.944 --> 00:58:43.815
smarter, it's a very long title,
Smarter and More Engaging
00:58:43.815 --> 00:58:46.500
Experiences with Microsoft's
Intelligent Services.
00:58:46.500 --> 00:58:49.079
All about the machine
learning and natural language
00:58:49.079 --> 00:58:51.607
processing services that
you saw here, and more.
00:58:51.607 --> 00:58:54.768
There's a session on building
your own smart bot put together
00:58:54.768 --> 00:58:55.860
by some of the folks in
00:58:55.860 --> 00:58:58.330
the Cortana Intelligence
Services team.
00:58:58.330 --> 00:58:59.980
So we have a lot to offer,
and there's many more,
00:58:59.980 --> 00:59:02.110
do look in your event guides.
00:59:02.110 --> 00:59:03.399
But I think that's about it,
00:59:03.399 --> 00:59:05.883
in terms of the content that
we'd like to share with you.
00:59:05.883 --> 00:59:08.234
We'd like to open it up for
questions, if you have any.
00:59:08.234 --> 00:59:10.510
I think,
are there folks with mics?
00:59:10.510 --> 00:59:13.552
I think there are a couple of
mics, so if you could make your
00:59:13.552 --> 00:59:16.284
way to the microphones and
ask your question there so
00:59:16.284 --> 00:59:19.536
that we make sure we get those
captured, that would be great.
00:59:19.536 --> 00:59:26.690
>> [APPLAUSE]
>> So
00:59:26.690 --> 00:59:30.860
my question is we saw this
awesome story around machine
00:59:30.860 --> 00:59:33.630
learning as well and kinda
that great web user interface.
00:59:33.630 --> 00:59:35.069
When are we gonna be
able to see that?
00:59:35.069 --> 00:59:39.221
>> Yeah, the LUIS web site that
we showed you is a machine
00:59:39.221 --> 00:59:41.110
learning system.
00:59:41.110 --> 00:59:43.090
And if you look for
sessions on LUIS,
00:59:43.090 --> 00:59:46.310
does your session cover
LUIS in more detail?
00:59:46.310 --> 00:59:47.950
>> We do at some level, yes.
00:59:47.950 --> 00:59:51.120
>> Yeah, there are plenty
of sessions on LUIS that
00:59:51.120 --> 00:59:52.200
you can take a look at.
00:59:52.200 --> 00:59:53.860
I'm happy to talk with you
afterward to share more
00:59:53.860 --> 00:59:54.538
about what that is.
00:59:54.538 --> 00:59:57.517
But that tool is a machine
learning tool, mm-hm.
00:59:57.517 --> 00:59:58.738
Yes?
00:59:58.738 --> 01:00:00.634
>> Is there any support for
user authentication.
01:00:00.634 --> 01:00:01.936
And then the framework itself.
01:00:01.936 --> 01:00:03.731
In this case,
you showed a stock purchase.
01:00:03.731 --> 01:00:05.464
How do we know it's really
somebody that should be
01:00:05.464 --> 01:00:06.793
purchasing stock
with that account?
01:00:06.793 --> 01:00:07.564
>> That's right.
01:00:07.564 --> 01:00:08.943
Great question.
01:00:08.943 --> 01:00:11.880
We don't have any built-in user
authentication at the moment.
01:00:11.880 --> 01:00:14.890
So we pass you the information
that we have received
01:00:14.890 --> 01:00:17.250
from the channel,
like SMS or Skype.
01:00:17.250 --> 01:00:18.470
So you have that identity.
01:00:18.470 --> 01:00:20.481
But if you want to
authenticate the user,
01:00:20.481 --> 01:00:22.499
you could build a link
to have them log in.
01:00:22.499 --> 01:00:25.499
Or find some other way to
authenticate the user.
01:00:28.901 --> 01:00:30.644
>> Yeah, how we about we
go to the other side, yes.
01:00:30.644 --> 01:00:33.840
>> Is it possible to framework?
01:00:33.840 --> 01:00:37.330
>> The user can then initiate a
dialogue, set up the alarm, and
01:00:37.330 --> 01:00:40.685
there's a method called,
which we haven't shown here,
01:00:40.685 --> 01:00:43.629
which your bot can send to
the connector to initiate
01:00:43.629 --> 01:00:45.295
an out-of-band message.
01:00:45.295 --> 01:00:46.820
>> Thanks.
01:00:46.820 --> 01:00:49.960
>> Could you tell me about
some try and get support?
01:00:49.960 --> 01:00:51.120
>> Over there.
I didn't even notice there
01:00:51.120 --> 01:00:51.780
was another mic.
01:00:51.780 --> 01:00:52.803
So sorry, yes.
01:00:52.803 --> 01:00:53.531
Can you repeat your question?
01:00:53.531 --> 01:00:54.832
>> Yeah.
01:00:54.832 --> 01:00:56.328
More support,
01:00:56.328 --> 01:00:59.851
do you have any plan to
support non-English language?
01:01:00.870 --> 01:01:05.031
>> If you use our translation
features, I actually,
01:01:05.031 --> 01:01:07.170
the product is brand new.
01:01:07.170 --> 01:01:09.926
And I don't know if we've tried
it with a non-English bot.
01:01:09.926 --> 01:01:12.660
But since we do support Bing's
translation service built into
01:01:12.660 --> 01:01:15.148
the service, it would be a great
thing for you to try out.
01:01:15.148 --> 01:01:16.020
>> Okay.
01:01:16.020 --> 01:01:18.060
>> The other thing to say is,
that tomorrow at 5 o'clock,
01:01:18.060 --> 01:01:22.340
we have a session that partly
covers the boot text and
01:01:22.340 --> 01:01:23.540
voice translation features.
01:01:23.540 --> 01:01:26.340
>> How about this one?
01:01:27.570 --> 01:01:28.910
>> I have a quick question.
01:01:28.910 --> 01:01:30.920
So, of course, it should be
connected to the internet,
01:01:30.920 --> 01:01:33.580
the bot, but should it be
also hosted on internet?
01:01:33.580 --> 01:01:38.661
It could be hosted on premise,
but connected to the internet?
01:01:38.661 --> 01:01:39.332
>> At the moment,
01:01:39.332 --> 01:01:41.970
the bot does have to have a web
hook call that's accessible.
01:01:41.970 --> 01:01:44.534
Now, you can secure that call
with https and the app id and
01:01:44.534 --> 01:01:46.450
app secret that we showed you.
01:01:46.450 --> 01:01:47.794
But the service interface for
01:01:47.794 --> 01:01:50.437
your bot has to be available
on the internet at the moment.
01:01:50.437 --> 01:01:52.062
>> Okay, thanks.
01:01:52.062 --> 01:01:52.755
>> Over here?
01:01:52.755 --> 01:01:54.424
>> Hey, I got a two-part
question for you.
01:01:54.424 --> 01:01:56.360
So first part you might
have already addressed, but
01:01:56.360 --> 01:01:57.026
I came a bit late.
01:01:57.026 --> 01:02:00.315
I'm curious about, Bot framework
itself is open source,
01:02:00.315 --> 01:02:03.210
what's the licensing and
governance about it, and
01:02:03.210 --> 01:02:04.470
how do I contribute?
01:02:04.470 --> 01:02:05.650
Is my first part.
01:02:05.650 --> 01:02:08.240
>> Yeah, half of the bot
builder, or sorry, half of
01:02:08.240 --> 01:02:10.790
the bot framework is open
source, the bot builder parts.
01:02:10.790 --> 01:02:11.760
It's available on GitHub.
01:02:11.760 --> 01:02:13.370
I haven't looked at
the license recently,
01:02:13.370 --> 01:02:14.800
you should take
a look at it there.
01:02:14.800 --> 01:02:15.770
>> Okay.
>> I don't wanna answer without
01:02:15.770 --> 01:02:17.670
having a really clear idea
in my mind of what it is.
01:02:17.670 --> 01:02:18.890
>> No worries.
>> But all the information is
01:02:18.890 --> 01:02:20.000
available on GitHub.
01:02:20.000 --> 01:02:20.510
>> That's great.
01:02:20.510 --> 01:02:22.000
Okay, so
that's just the builder, but
01:02:22.000 --> 01:02:24.960
the actual bot stuff
itself is deployed and
01:02:24.960 --> 01:02:28.200
run on your premise, or how's
the distribution part work?
01:02:28.200 --> 01:02:29.531
>> Yes.
So the bot connector is
01:02:29.531 --> 01:02:30.396
deployed in Azure.
01:02:30.396 --> 01:02:30.980
>> Okay.
>> And
01:02:30.980 --> 01:02:33.820
that's a service that we
maintain and operate, and
01:02:33.820 --> 01:02:35.560
we have the source code for.
01:02:35.560 --> 01:02:36.622
And then the bot builder is
01:02:36.622 --> 01:02:38.511
code on GitHub that you
can put in your own bot.
01:02:38.511 --> 01:02:39.692
>> Got it, okay great.
01:02:39.692 --> 01:02:40.625
Thank you very much.
01:02:40.625 --> 01:02:42.260
>> Absolutely.
Over here?
01:02:43.710 --> 01:02:48.030
>> So if I had a mobile app that
I wanted to have as a front end
01:02:48.030 --> 01:02:51.710
for a chat bot, would I be doing
that through the connector,
01:02:51.710 --> 01:02:54.610
or would I be doing that
like directly messaging
01:02:54.610 --> 01:02:55.995
the API itself?
01:02:55.995 --> 01:02:57.910
>> This is a fantastic question,
it's almost like you're a plant,
01:02:57.910 --> 01:02:58.560
this is great.
01:02:58.560 --> 01:02:59.330
I know that you're not.
01:02:59.330 --> 01:03:00.410
>> I am not a plant.
01:03:00.410 --> 01:03:01.540
>> But that's fantastic.
01:03:01.540 --> 01:03:04.060
So we actually have, so you
saw our many channels, right?
01:03:04.060 --> 01:03:06.976
Where you can connect to users,
SMS, Skype, others.
01:03:06.976 --> 01:03:09.250
We have a API channel
called Directline,
01:03:09.250 --> 01:03:12.440
which is a direct line
from your application or
01:03:12.440 --> 01:03:14.760
your website directly
to your bot.
01:03:14.760 --> 01:03:17.251
So to use your bot within
a mobile application,
01:03:17.251 --> 01:03:19.805
you would host your bot
on the bot connector, and
01:03:19.805 --> 01:03:22.049
then you would use
the Directline client,
01:03:22.049 --> 01:03:25.163
which is available also as
a node.js and C# proxy, to call
01:03:25.163 --> 01:03:28.215
from your mobile app into
the front side of the connector,
01:03:28.215 --> 01:03:31.112
if you will, right beside
where all the channels are.
01:03:31.112 --> 01:03:34.610
And so, your mobile app would
be a peer of Skype and SMS,
01:03:34.610 --> 01:03:36.035
and slack and others.
01:03:36.035 --> 01:03:36.564
Does that make sense?
01:03:36.564 --> 01:03:39.710
>> Yes, and so is that
client library the C# one,
01:03:39.710 --> 01:03:41.833
is it a portable class library,
01:03:41.833 --> 01:03:44.519
can it be used in
a Xamarin application?
01:03:44.519 --> 01:03:46.517
>> I actually don't know whether
it's portable class library.
01:03:46.517 --> 01:03:47.776
I will follow up on that.
01:03:47.776 --> 01:03:49.981
All of our C# libraries
are available on NuGet so,
01:03:49.981 --> 01:03:52.287
if you take a look there,
you'll be able to answer for
01:03:52.287 --> 01:03:53.483
yourself pretty quickly.
01:03:53.483 --> 01:03:54.910
But I'll look into that.
01:03:54.910 --> 01:03:55.500
>> Thank you.
01:03:55.500 --> 01:03:57.180
>> I think the last question.
01:03:57.180 --> 01:03:58.870
>> Yeah,
last question over here.
01:03:58.870 --> 01:04:00.095
>> Well I hope it's a good one.
01:04:00.095 --> 01:04:02.075
>> [LAUGH]
>> Well it's a bit late, but
01:04:02.075 --> 01:04:05.145
in terms of deployment, if I had
a third party assembly that I
01:04:05.145 --> 01:04:07.796
wanted to attach into my bot and
deploy it out there,
01:04:07.796 --> 01:04:10.349
it'll just do an automatic
NuGet restore for me?
01:04:10.349 --> 01:04:13.392
>> So the automatic NuGet
restore at build time is
01:04:13.392 --> 01:04:16.990
something that Visual Studio and
MSBuild already do.
01:04:16.990 --> 01:04:18.130
>> Yes.
>> I'm not really part of
01:04:18.130 --> 01:04:18.670
the bot framework.
01:04:18.670 --> 01:04:20.920
So we don't actually host
your assembly at all.
01:04:20.920 --> 01:04:23.390
You take your code and you put
it on your own server, and
01:04:23.390 --> 01:04:26.200
if you wanna do automatic NuGet
package restore on Build.
01:04:26.200 --> 01:04:27.850
>> Yes.
>> When you push your
01:04:27.850 --> 01:04:28.790
service to the Cloud.
01:04:28.790 --> 01:04:30.217
>> Correct.
>> Totally, you can do that.
01:04:30.217 --> 01:04:30.825
>> Thank you.
01:04:30.825 --> 01:04:31.500
>> Mm-hm.
01:04:31.500 --> 01:04:32.940
Thank you all so much for
sticking around,
01:04:32.940 --> 01:04:34.765
there's a couple slices of
cold pizza if you'd like any.
01:04:34.765 --> 01:04:38.870
[APPLAUSE]