"тнιѕ вℓσg ¢συℓ∂ ѕανє уσυя мσηєу ιƒ тιмє = мσηєу" - ∂.мαηנαℓу

Thursday, 10 August 2017

How to Create an Azure Bot using QnA Service

One of the cool features I explored with Azure is Azure Bot Service. Lets see how to create a simple Azure Bot using QnA Maker service. The key concept is that QnA maker service extracts the data from the Frequently Asked Questions (FAQ) sites and use this info as the knowledge base for the Azure Bot. For instance :https://www.microsoft.com/en-gb/software-download/faq

If you dont have any FAQ URLs then you could upload a file containing your question and answer pairs. QnA maker can extract data from these too. 

The supported file types are 


  • .tsv,.pdf,.doc,.docx,.xlsx - each under 2 MB


Sample file from Microsoft QnA maker is pasted below.

How many alphabets are there in english? There are 26 alphabets
How many words are there in english? There are so many words
How many languages are there in the world? Count less
What is your mother tongue? binary


Remember Microsoft QnA Maker is fee and very easy to use.

So let's do it. To make it easy, make sure that you use same azure account for the QnA service as well.

Here is the link to the QnA Maker.

https://qnamaker.ai/

To create a new qna service click on the Create new Service as shown below.





Fill in the info as shown below. Feel free to choose your faq site and also files if you prefer.




Click on the Create button as shown below. Yes we are halfway through.




If you wish to create a new Question answer pair you could do that by click on the add new QnA pair button.



The newly added Question answer pair is shown below. Once you are happy with the content, click on the publish button on the top right corner.




Click on Publish to confirm.



After publish you would see message show the service has been deployed.




Now lets navigate to Microsoft Azure.

New -> Data+ Analytics->Bot Service ( Depending on the Azure versions, navigation might be slightly different). 





Create a new bot service as shown below.  You would see a notification that the deployment is in progress.



Once the deployment is finished, nagivate to app service and choose the bot you just created. The next bit is the registration of the bot. So click on the Create Microsfot App ID and pwd button. This will take to a new window. When its prompted, copy the pwd. Then you could navigate back to the previous screen. When you try it you would understand how simple step is this. 



Select the Question and Answer bot after entering the App ID and password. Then click on the Create bot button.



If you have used same account for QnA service and Azure then you could easily select your QnA service that you created as shown below. Click on the OK button after that.




Your bot is on the way : )

Click on the test button for a quick test.





So here is our first test results. In simple words, Q and A pairs were extracted from the QnA service and linked with our newly created bot.



Now lets see how do we bring our bot to skype. 

So this concept is called Channel. A channel could be Skype, Facebook messenger, Skype for Business, Kik etc.

For instance, lets see skype channel.

So navigate to Channel section as shown below. Please note the highlighted button 'Get bot embed codes'. 



This will popup a link to join the skype.

For instance, https://join.skype.com/bot/yourguidgoeshere



Now if you copy this URL and paste on your browser ( assuming that the Skype is logged in )
you could see a popup to add a new contact to skype.



That's all. From now on you could chat to the Bot if you are bored ; - )






Basics of Azure Service Bus- Queues, Topics ( - Subscriptions) & Relays

If you want to understand the basic knowledge of Azure Service Bus -Queues , Topics ( - Subscriptions), Relays concepts, I would recommend the below link

These concepts are clearly explained in here.

https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-fundamentals-hybrid-solutions


Found an amazing tool to play around Azure Service Bus -Queues , Topics ( - Subscriptions), Relays as well. Its called The service bus explorer.

Ref: “The Service Bus Explorer allows users to connect to a Service Bus namespace and efficiently administer messaging entities. The tool provides advanced features like import/export functionality or the ability to test topic, queues, subscriptions, relay services, notification hubs and events hubs”



Using this tool, I tried sending messages to Service bus queues. It works like a charm. You could also send multiple messages ( For instance, 100 messages, 1000 messages if you  prefer to test in that way).  The advantage is that you dont need to develop another application to test sending messages to the Azure service bus queue / topic / relays.