You Bot-cha! It’s Easy to Create a Rule-Based ChatBot using Azure Bot Service and InRule

PJ

Parul Joshi

08/14/2019

From e-commerce to customer support to marketing, HR and more, a simple Google search makes it clear: chatbots are the future of business. In fact, a search of “bot business” delivers 280,000,000 results in Google (on 12 Aug 2019).

A recent Facebook study shines a light on the reason behind the surge in popularity of bot technology. The study revealed that 56% of people would rather use a messaging application than make a phone call to customer service. Hence, chatbots are one of the most commonly used bots in businesses today.

While the pool of options for chatbot services continues to grow, most of the technology presents a significant challenge: requiring a developer to maintain the logic through code.

Given the demand for chatbot services and the fact that InRule specializes in allowing business people to maintain decision logic, we wondered if we could combine these two, powerful technologies to create a chatbot experience.

We leveraged the Azure Bot Service to build a basic bot and irAuthor to create a banking rule application. Then, by calling the rule engine from the bot we could easily interact with the customer. Bots can integrate with different user-facing channels (like Slack, Skype, Messenger, etc.); for this example, we used Slack.

Here are the steps we took to create a rule-based chatbot:

  1. Create a bot with Azure Bot Service
  2. Create a banking rule application using irAuthor
  3. Call the rule application in bot code using Visual Studio
  4. Upload bot code to Azure
  5. Connect a bot to one of the available channels supported by Azure Chat bot

InRule Chatbot Integration with Azure Bot Service

1. Create a bot with Azure Bot Service

The Azure Bot service provides a tool to build, test, deploy and manage all bots. Azure makes the bot creation and integration process straightforward. Follow these steps to create a basic web application bot, test the bot in the Web Chat and eventually download the source code to edit it. We used the C# template to create a bot using the Bot Framework SDK v4.

2. Create a banking rule application using irAuthor

Once we created and downloaded our bot code, we created a banking rule application using irAuthor. This is where the magic happens!

  • The rule application accepts a question asked by the customer.
  • The application then scans the question against the existing categories to pick an appropriate rule set to run.
  • Each rule set has a list of questions:
    • If a current session already has a response for that question, the response will be displayed to the customer.
    • If a current session does not have an answer, the application will run the rule set to ask additional questions to collect relevant information.
  • Once the application has all the information it needs, it stores and generates the response to the customer.

For example, if a customer asks for an account balance, the application would need to know the unique account number to display the account balance.

Business Language Rule for Account Balance for Chatbot

We used a Decision Table to map the customer’s question with the existing categories and the Vocabulary feature to make the Language Rule more concise and readable.

Decision Table to Map Question with Categories and Vocabulary

3. Call the rule application in bot code using Visual Studio

Once the rule application was ready, the next step was to call the rule engine in the bot code. The bot application stores the values to track existing customer responses.

Call the rule engine from bot code

Visual Studio for calling the rule application in bot code

4. Upload bot code in Azure

Update the code in Azure and use the Web Chat functionality to test the bot.

5. Connect a bot to one of the available channels supported by Azure Chat bot

Once the bot code is working and updated in Azure, integrate this bot with other channels such as Slack, Skype, Web App, Messenger, etc. We integrated our banking bot with the InRule slack channel.

Slack integration with bot

By using InRule along with Azure Bot Service, it’s easy to automate interactions with customers, prospects, employees and more. Please comment below or reach out to us if you have any questions!