"Bot" is a popular buzz word nowadays. Everyone is talking about bot services. I've decided to explore this and provide you with 10 easy steps to create yourfirst chat Bot using Azure Bot Services.
So, let’s start by understanding what chatbots are. You can think of a chatbot as an intelligent program that interacts with human or users. It simulates conversations with human users.
As mentioned, it is an intelligent program that uses Machine Learning to understand patterns and respond accordingly. In a nutshell, we can say that it's an Artificial Intelligent program that uses Machine Learning to mimic human conversation.
Microsoft, Facebook, and other companies have come up their own chatbot framework.
In this example, we are talking about Microsoft Azure Bot Service, which is super easy. You can create chatbots and deploy and inject them with different sources such as Skype, your own site, Slack, Facebook, etc. However, in this post, we are only going to create a chatbot. Integration with other sources like Facebook and Slack is not part of this post, but we will this see in upcoming posts.
There is only one major prerequisite for creating your chatbot: having an Azure portal account.
Now, let’s create your first chatbot using Azure Bot Service.
1. Define Basic Information
There's a bot service option, which is currently in preview mode through the following actions:
App Services > Intelligence + analytics > Bot Service (Preview).
Once you click Bot Service (preview), you will get the following option where you have to define basic information like app name and location.
Once you have created it, you will get the following screen where you need to create App ID. This is a prerequisite to authenticating your bot with the bot framework.
When you click Create Microsoft App ID and password, you will get the following screen. You need to create a password and paste it in the below screen. To finish, click “Finish and go back to Bot Framework.
3. Choose Your Programming Language
You will see the below screen where you need to select your code language. I like C#.
Just below this language option, you have some other options, as shown in below screen, which is basically a template of your bot. You can select any template that makes sense and fulfills your objective. In this example, I have selected the Language understanding template.
4. Use LUIS to Teach Your Bot
The next interesting objective is to teach your bot through LUIS (Language Understanding Intelligence Service). LUIS helps teach the bot. You can log in using the AppID that we created earlier.
5. Manage the Bot's Application Model
Once you have logged into LUIS, you will get the following screen with a dashboard from which you can manage your Chatbot application’s model:
The next step is to teach your model.
6. Teach Your Model
If you are not aware of LUIS currently, just understand that it is a teacher who teaches your bot. If you say “Hello,” then your intention is a greeting. This is how you teach your model. I will share a separate post for LUIS soon.
7. Train Your Model
You can train your Model by clicking Train in the left bottom corner. Once your training is done and you think it is working fine, then you can deploy or publish it. You can test its query parameter sas shown below.
8. Modify Your Bot
Once you are done with LUIS and come back to your Azure Bot service application, you can manage the C# code and modify it further for the different intents that you set in LUIS. For example, in above screen, you will find three intents:
Similarly, you can create multiple intents to make your chatbot robust. Here, if you see the code in Azure itself, you don’t need to worry anpit different settings for publishing and getting the code up and running.
9. Update Code to Match Intents
As we added different intents in our chat model, we need to update our C# code, as well. To add any intent, you need to modify
BasicLuisDialog.csx, as highlighted in yellow below.
If you see the above image, you will find that we have added our two intents (greetings and locations) and written our custom logic.
We can test right away by entering the different statement in chat in right chat panel.
Once you are satisfied with your work, just publish it. I hope this is enough content for getting your hands on the Azure Bot Service for the firs time. I know you might face some challenges in LUIS, but trust me — it is super easy. Just try it. In any case, I am going to write another post for LUIS.
Please share your inputs what you think about this post and the Azure Bot Service.