I am sure by now you have heard about Bots, and not talking about Robots either. I am talking about the little auto chat bots that can chat with you, help you but have no actual real person behind them. I am sure you have used one whether on a shopping site, or even something like Siri or Cortana, maybe even used Alexa on an Amazon device too. This technology is fantastic and what is great is that it is available through Azure Services for us to integrate with our custom applications.
Within the Azure Services cloud, Microsoft provide two pieces, a Bot Framework and then a Bot Service. These two are connected but are used for different things.
The Bot Framework is a platform for building, connecting, testing, and deploying powerful and intelligent bot. With support for .NET, Node.js, and REST, you can download the Bot Builder SDK and quickly start building bots with the Bot Framework. The Bot Framework enables you to build bots that support different types of interaction from simple conversations to complex decisions.
The Azure Bot Service provides an integrated environment that is purpose-built for bot development, enabling you to build, connect, test, deploy, and manage bots, all from one place. It is powered by Microsoft Bot Framework and Azure Functions, which means that your bot will run in a serverless environment on Azure that will scale based upon demand.
The Bot Service enabled you very quickly create a Bot using either Node.js or C#, using some base templates that Microsoft have defined.
Now we know the difference, the next question is “Why use a Bot Framework?”
Why use a Bot Framework?
Developers writing bots all face the same problems: bots require basic I/O, they must have language and dialog skills, and they must connect to users, preferably in any conversation experience and language the user chooses. The Bot Framework provides powerful tools and features to help solve these problems.
Within Azure, Microsoft provided the Bot Builder and a Developer Portal for not only building the solution, but also provisioning and controlling it. The Bot Framework natively support connected networks and services such as the ability to post messages to slack, skype or even just send someone to a web page.
How do you get started?
My personal recommendation before actually writing the code yourself, I would use the Azure Bot Service as your playground. To do this browse to the Azure Portal Site.
Log into the site and then click the “New” blade, then search for “Bot”, and select “Bot Service”. There are few to pick from, so make sure you select “Bot Service (Preview)”.
Next press the “Create” button, then completed the details as you need, you will need an active Azure Subscription. The name will become the DNS URL for the site so make it something useful.
Next you have to wait for the Bot Service to actually create what is needed, it should not take too long but will be notified when it is completed. Once it is completed you will then need to generate an App ID and password, as well as selecting the type and language of Bot you want to create.
This part can take some time as it provisions all the components needed for the Bot to work. Once completed you can navigate from the completed message and it loads the UI into the Azure console. Navigation is performed by the top navigation.
Clicking the Settings link allows to set specific values for the overall Bot you are creating.
In order for you to access specific features you will need to have access to other services such as LUIS for speech recognition. To do this you need to have registered with Azure and received an ID that you can then add to the Bot.
Adding these extra services can be quite complex, as it requires you to often setup these services one by one within Azure to be able to consume them.
To add other services (channels), you can simply click the “Channels” navigation and select which ones you want to connect.
For this sample Bot it is connected to Skype and Web Chat only. Now we get to the fun part where we see the code, which we selected previously as C#. Once we load the code for the very basics you can see right in the code that the Bot will return a simple message when something is typed into it.
You can see this by pressing the “Test” button in the navigation.
This code can be changed to be whatever we wanted. I changed the code so it talks to the QnA Maker’s list of questions. This meant I could create a conversation like this:
As you can see creating simple and fun Bots is very powerful and could have great implications for the way we work now and in the future.