Building A Microsoft Azure Bot Framework Tutorial

Building A Microsoft Azure Bot Framework Tutorial

Every business focusing on offering personalized customer experience is adopting Chatbots.

These chatbots are basically software that are capable of having human like conversations and are powered by machine learning and artificial intelligence.

Bots are usually built on the top of a platform like Azure, Botsify, etc. and then hosted onto the application. These can be mainly categorized as:

(a) Command based

(b) AI based.

(The cost and power of the bots depends on the above factors)

Command based Chatbots: Rely on a databank or a knowledge base of question and replies. The bots reply by selecting an answer that matches the context of a query. Command based chatbots are not intelligent enough to create their knowledge base thus making them capable of answering only a limited set of queries.

AI based Chatbots: They can answer enigmatic questions. The user here does not have to be very specific when asking questions to these chatbots.  The chatbots here have become intelligent over the time learning from the past conversations and reply using natural language processing (NLP).

Both the above categories have their own pros and cons. When we say that the AI chatbots are capable of answering a wide range of questions, they might fail to give grammatically correct answers and also struggle with longer sentences. Whereas the command based bots can give the user more reliable and grammatically correct answers but fail to answer any question that comes out of the box.

How much does an Azure Chabot cost?

The direct line channel of an Azure Chatbot is free for the first 10,000 messages month wise. With such a free service, the Azure chatbot started costing $0.50 for other additional messages of 1000. You can use the free tier and stop using it!

A Chatbot Comparison Table

 

Bot Name

Features

Programming Languages

IBM Watson Conversation Service

Built on a neural network with three main components; Intents, Entities, Dialog

Node SDK

Java SDK

Python SDK

iOS SDK

Unity SDK

Microsoft Bot Framework

Recognizes the user’s intent.

 

Incorporates LUIS for understanding natural language, Cortana for voice, and the Bing APIs for search.

Bot Builder SDK (.NET SDK and Node.js SDK.)

Bot Connector

Developer Portal

Bot Directory

AgentBot

Knows natural language.

Memory to continue consistency throughout long conversations.

Collect client information to carry customized solutions.

 

Use REST API to integrate with CRM and other platforms.

wit.ai

Use Entities, Intents, Context, Actions

Natural Language Process (NLP)

 

Node.js client

Python client

Ruby client

On other platforms: HTTP API

Api.ai

Go with the query to the most appropriate intent based on information contained in the intent and the user’s machine learning model.

 

Converts the query text into actionable data and returns output data as a JSON response object.

 

Influences predefined data packages composed over several years.

Android

iOS

Cordova

HTML

JavaScript

Node.js

.NET

Unity

Xamarin

C++

Python

Ruby

PHP (community supported)

Epson Moverio

Botkit

Java

Microsoft Language Understanding Intelligent Service (LUIS)

Intents and entities.

All LUIS applications are domain-specific topic or content related.

Active learning.

 

Use pre-existing, world-class, pre-built models from Bing and Cortana.

 

Deploy models to an HTTP endpoint with one click. LUIS returns easy-to-use JSON."

C# SDK

Python SDK

Node JS SDK

Android SDK

 

Create an Azure Chatbot

Step 1:

Post login to the azure portal ‘Add a new resource’ for ‘Web App Bot’ in ‘AI + Machine Learning’ under the Azure Marketplace section.

Web App Bot

Step 2:

Add details for the bot.

  • Bot Name: Enter a Bot name in the respective field.
  • Subscription: Select the azure subscription account here.
  • Resource Group: Select the resource group to put this chatbot under.
  • Location: Enter the location of the resource group.
Add details for the bot

 

Step 3:

Add further details for the App Name and select the Bot Template.

Create a new Service plan here, if there isn’t any existing plan for the subscription account.

Bot Template

 

 

  • The Bot template we are selecting is the ‘Question and Answer’

 

  • This template will allow us to attach the knowledge base to the bot.

 

 

knowledge base

 

Step 4:

After selecting the template, we need to create a knowledge base or a databank, based on the requirements.

The knowledge base can be added here: https://www.qnamaker.ai/Create

databank

Step 5:

Going back to the azure portal, create a resource called ‘QnA Maker’.

Add the required details:

  • Name: Name for the QnA Maker resource.
  • Subscription: Select the azure subscription account here.
  • Resource Group: Select the resource group to put this resource under.
  • Pricing Tier: Set the minimum price here.
  • App Name: Enter the name of the QnA Maker application that we need for the mapping with the knowledge base created in step 4.
QnA Maker

 

Step 6:

  • Connecting the QnA and the knowledge base (KB)
  • There are 3 details that are required to be filled in here.
  • While creating the knowledge base, we signing in using the Microsoft account with auto-filled details. details.
  • Once the details are confirmed, ‘Create the KB’.

 

Connecting the QnA and the knowledge base (KB)

 

Step 7:

Every created KB has a basic set of attached question answers. In addition, we can add several other QnA pairs as per the requirement.

Once the KB is updated, clicking on ‘Save and Train’ will update the KB source.

 

KB source

 

Step 8:

Publishing the KB to the QnA Maker resource.

Unless the KB is published, it cannot be accessed through the bot.

Publishing the KB to the QnA Maker resource

 

Step 9:

Collecting keys from the Settings.

These keys need to be added to the bot settings.

Collecting keys

 

Step 10:

The KB is all set and ready to be used. Now, this can be connected to the bot’s channels.

bot’s channels

We will connect it to the Web channel and after get connected; it will give us placeholder code that needs to be included into our web project.

Azure AI Resource

In the above piece of code, TestWebAppBot2019 is the name of the Azure AI Resource that we created in Step 1 and named in Step 3.

Upon running the application with the above code, it delivers the below output.

The question asked here from the web application is ‘What’s your age?’ and is responded by WebAppBot2019 as ‘I’m age free.’

 

This particular answer has appeared as a result of the QnA pair from the knowledge base created and published above.

Chatbot

 

Jobs Replacement with Chatbots

With the revolutionary contribution of AI chatbots based of NLP, the businesses around the globe are growing more efficiently. However, it is replacing human employees with intelligent and deep learning based chatbots. According to a study, following jobs are getting affected for the rise of chatbots:

  • Cashiers (97%)
  • Bookkeeping clerks (97%)
  • Credit analysts (98%)
  • Accountants (94%)
  • Paralegals (95%)
  • Telemarketers (99%)

 

Moving On

With the rise in automation technologies in all sectors of the industry, chatbots can surely be impactful for both businesses as well as the customers. Chatbots are predicted to replace all human interaction for providing assistance on a business website. Thus, implementing them on the websites can help high quality customer interaction and eventually a significant market presence with better products & services.

Author

Talk To Our Experts