I am sure you have encountered a chatbot somewhere before. More and more companies such as online stores or those offering support in various aspects use this solution. This is especially useful if potential customers ask some recurring questions or report similar problems. The company can then prepare standard answers and the created bot can send them in the chat. How to create such chatbots using Azure Bot Service? I will explain that in today’s post. Let’s get started!
What is a bot?
It can be described as a software program or script that makes decisions for other program or user. Generally, programmers set and determine their purpose and role. The main usage of bots is doing repetitive automated tasks. In our case, this task is just answering the messages and interacting with users.
Azure Bot Service
Azure Bot Service is a service that provides tools to build, test and deploy intelligent bots. Everything can be configured in one place. We can distinguish some elements of this solution:
- Bot Framework Service
- Bot Framework Tools
- Bot Framework SDK
- Bot deployment and configuration in Azure
How does it work?
Let’s imagine you have in your company some communication channels such as Outlook, Slack, Skype and Microsoft Teams. In this case, Bot Framework Service is a channel that integrates all of mentioned earlier. The main task of this service is to translate these unique messaging patterns into a single message. Then this single message goes to your bot and is understandable for him. That is clear, right?
What does an example bot work like?
The whole process begins with connecting a user with a bot by connecting to the communication channel in advance. As a result, a message is sent to a bot that the conversation is about to begin and a user joins the channel. Then, a bot needs to join the channel as well. After that, everything is ready to start this conversation. When a user writes ‘How are you’ on the Slack channel, this message is being sent to Bot Framework Service, which then is going to your bot. Hereafter you can process this message, connect with various services, use some AI & ML algorithms to choose the right answer and then write a reply message.
I think that this theory is enough, now let’s move on to practice! I will show you how to create a bot service. So go to Azure Portal and click to ‘Create a resource’. In the search pool, write ‘bot’ and choose Web App Bot.
Then click ‘Create’ and you should see a form with configuration settings:
Provide the name, choose your subscription and resource group. Choose a location that is the closest to your place. Select a pricing tier and write an App name (this is the name of the service that will be hosting your bot logic). The next one is a bot template, you have some possibilities there – SDK language and templates. The available templates are Echo Bot and Basic Bot. The first is a bot that echoes back the user’s message. Basic Bot is a more advanced option that contains various services like Bot Analytics or Language Understanding. For the purposes of this post, I choose the first option. Then pick App service plan and Application Insights Location. I recommend choosing the same location as before, it is the optimal solution. After all the settings, you can click Create.
After 1-3 minutes your service will be created, then you can go to the resource. You should see the view below:
So select Test in Web Chat from the left navigation. This is a simple web chat that you can use for testing your bot:
When you will join the chat an initialization will happen and after that, a bot will be ready to work. So if you will send some message there, an Echo bot will respond, as you can see on the image above.
The service gives us many possibilities, such as integration with Slack or Skype messengers, as I mentioned earlier. You can also download the source code and modify its operation, or connect to some external services. However, I think that is enough for today. For sure, soon there will be more posts on this topic! If you want to delve into this topic today, I refer you to the official documentation.