Brian McKeiver's Blog

Building a Kentico E-Commerce Chat Bot - Part 3


This is the third part of my blog post series on Building a Kentico E-Commerce Chat Bot. Make sure that you have read the part 1 and part 2 of the series before continuing. The goal of this post is to get down and dirty on the Azure side of the solution. We will walk through what it takes to get started with your very own Azure Bot Service, Bot Builder Framework account, and LUIS account.


Get Your Microsoft Account Ready

As I mention above, we are going to focus on creating all of the basic building blocks of the chatbot in this post. To do that, it really comes down to having all of the right accounts and services created in Azure, Bot Builder, and Microsoft Cognitive Services. And as you might have guessed, for some reason, Microsoft made this as about as complex as possible.

There are at least three different ways to start the process. None of them made complete sense to me when I was first looking at this all. But at this point you want to make sure you have your Microsoft account and Azure Portal account ready to go. Because you are about to sign in or create accounts in 2 or 3 places. I'll start by showing you the path I took to creating my first bot, which includes starting with the link below:


Getting Started:


Basically this is the one piece of documentation that ended with a working prototype for me. Open that link in a new window and use that as the actual step instructions for how to create your bot. I'll add a few comments and recommendations below as you go.


Create the Azure Bot

The first step is to login in to the Azure Portal and create a new instance of a Bot Service. One thing that I recommend when creating any services in Azure, like this bot service, is to create them all within a unique resource group to keep them somewhat organized. I have created mine in a resource group of Bots.


Azure Create New Bot


Also, don't forget the check the box next to Pin to dashboard to keep the new tile visible on your portal dashboard. Click the Create button to move on.

Now we need to connect the Azure Bot Service to the Microsoft Bot Builder framework. Luckily the Azure process does this for us, just follow the instructions on screen.


Azure Create New Bot AppID


As it says in the docs, you click the big blue Create Microsoft App ID and password button. From here you walk through authenticating to the generate application page and most importantly generate a secure password. Do as the instructions say and copy and save the password it gives you.


Azure Create New Bot App Password


Make sure you copy the password from the modal and paste it into the correct input box on the original screen. Continue on to choosing C# as the language for the bot and then scroll down to choosing your Bot template to start with. 


Azure Create New Bot App Password and Language


Now as I mentioned in part 1, this chatbot is going to use LUIS to give us a little natural language processing ability. So go ahead and select the Language understanding template and click on Create bot. You would think at this point you would be done right? Well not exactly. Inside of a modal now we need to connect everything that we have in Azure to Microsoft Cognitive Services.


Azure Create New Bot Language Understanding


After you click the Create bot button a modal will appear to tie your bot to LUIS. Go ahead and click the Sign-in button and either authenticate to your existing account in Cognitive Services, or create a new one. You will most likely need to grant the site permissions to do so. So go ahead and do that too.


Connect Azure Bot Service to LUIS



LUIS Permissions


When this is all done, That will bring you to a screen that will generate the correct LUIS application and LUIS API keys for your bot. Click the blue Continue button to do that


Connect Azure Bot Service to LUIS Create


Your Azure Bot service is now created and registered in LUIS and the Bot Builder framework. At this point, you actually have a working Bot template. The source code and solution were generated for you by Azure. You can use the test harness inside of the Azure service and start chatting right away. Basically it gives you the hello world example that you would expect. Click on the image below to see the full console and chat window. You can start typing hello world now and see the bot actually work.


Azure Bot Service Console


Since the Bot service is really just a set of Azure Functions, you can actually even edit the code right here and continue on with the rest of the blog post series. However, editing inside of a browser window is not my favorite thing in the world. Have no fear though, I will show you how to fix this later. 


Up Next

In this post we reviewed the key concepts for creating an Azure chatbot using the Bot Builder framework. In the next post, part 4 of Building a Kentico E-commerce Chatbotwe will review the Language Understanding Intelligent Service (LUIS) aspect of the solution. During the review we will show you how to create and train our bot to communicate with humans in a nice way.