How to Build an HR Chatbot using Microsoft Azure Bot Service?
My first thought after using Microsoft Azure for building a chatbot is that it’s a bit complex. Particularly, the initial setup required in the local machine is a long task.
In this example, I’m explaining how you can use the Azure bot service to build a simple HR Chatbot. The chatbot is built to answer frequently asked HR questions, based on the knowledge base.
To make your life easy I’ve uploaded the source code in Git. The steps to be followed are given below – let’s explore it!
Prerequisites:
- Azure subscription: https://azure.microsoft.com/free/
- NodeJS: https://nodejs.org/en/download/
- Microsoft bot framework emulator: https://github.com/microsoft/BotFramework-Emulator/releases
- VS Code
- Install latest version of the MSBot CLI tool: npm install -g msbot
- ngrok (if needed). Please read more about it before setting up: https://ngrok.com/download
Create a Knowledge Base
Log on to qnamaker.ai using your Azure credentials. Then, click on Create a knowledge base.
Then click on Create a QnA Service. It will navigate us to the Microsoft Azure Portal.
Provide the below details in the Azure screen and click on Create. It will give a deployment complete message.
Click on the burger icon on top left corner to navigate to My Dashboard. Then, click on hr-chatbot-demo(App Service).
And, add below two new application settings.
Next, navigate back to qnamaker.ai and click on Refresh. It will populate the details we configured in Azure portal in the previous step.
Name your KB as “hr-chatbot-kb”.
Then, upload the .tsv file containing the HR FAQs. You can download it whole project from my git repo. Unzip it and you will find hr-qna.tsv file in it. Navigate to that folder and upload it.
Finally, click on Create you KB. After creating KB it will navigate to a new screen where you will find the FAQs from the .tsv file uploaded. Then, click on Save and train > Publish.
Congrats, you’ve now completed setting up a knowledge base. We will be using the below details in the next steps.
Build and Test
Download the project from Git. Unzip it and open it in VS Code. Open the file hr-chatbot.bot and add beloe details from the previous step. subscriptionKey is the Subscription ID you can find in Azure portal.
Open Command/Terminal and execute these 2 commands:
Now we are ready to test the chatbot. Open the Microsoft Bot Framework Emulator. Click on Open Bot > enter Bot URL as given below > Connect.
Well done, start chatting!