Microsoft BOT Framework: chatbots and hybris. Skype, Facebook and other communication channels.
Introduction2016 is a year of conversational e-commerce: a number of large retailers are already experimenting with chatbots. This spring, Kik, a messaging app with 275 million registered users, launched a bot store for brands and publishers to build their own bots that deliver services to users. Sephora and H&M have kik-powered bots that help shoppers browse and buy their products. Taco Bell showed off its TacoBot, a way to use the messaging app Slack to place a meal order. Amazon introduced its Echo, Google announced Allo, Facebook built their bot engine on top of their Messenger (and it is capable now of accepting payments!). Recently, Microsoft launched their Bot Framework that allows developers to write bot code once and, using the Microsoft Bot Connector, deploy on multiple channels, including Skype, Slack, and SMS. This article is about the integration of Microsoft Bot Framework and hybris. I managed to create a PoC to demonstrate how different channels (in my example I used Skype and Messenger) work with the MBF.
Microsoft Bot FrameworkAt the core of Microsoft’s bot work is the Microsoft Bot Framework. The Framework consists of three pieces:
- Bot Builder SDK for those interested in building bots using C# or Node.js. The core of Bot Builder SDK is a ChatConnector component which interacts with bot API.
- the Bot Connector for registering, connecting, publishing and managing bots to text/SMS, Office 365 mail, Skype, Slack, Telegram, kik and more. We do not need to adjust our application for these different channels.
- and a Bot Directory of bots developed with the Bot Framework.
Hybris IntegrationThe architecture is similar to the one I described for the hybris/Facebook Messenger integration. There is a component that is basically a web service server to process the requests from bot framework. I will refer to it as Bot Server. The main tasks of this piece of the software are processing user input and sending the automated replies back to the user are key responsibilities of this module. So in its simplest form, it may work completely independent from any other resources, such as hybris e-commerce storefront or employee-facing components (Cockpits). There are two types of integration:
- providing BotServer with hybris data and
- providing hybris with BotServer data.
Microsoft LUIS – natural language parserAccording to luis.ai, LUIS is a Language Understanding Intelligent Service, which offers a fast and effective way of adding language understanding to applications. With LUIS, you can use pre-existing, world-class, pre-built models from Bing and Cortana whenever they suit your purposes and when you need specialized models, LUIS guides you through the process of quickly building them. LUIS is a part of Microsoft Cognitive Service. LUIS can work directly with the Bot Framework or you Bot Server can use Luis as a service (using Microsoft Cognitive services API). The last approach is more flexible because you can use both natural language requests and fixed commands in one chat. These examples show how LUIS works. Intents. Intent means just what we desire and what is our intention. Intents are basically groups for the infinite number of natural language requests. AI network connects natural language patterns to intents dynamically based on some examples from you that form the knowledge base. Utterances. These are examples of natural language requests that are examples of usage. You need to explain the structure of these requests to LUIS. It will help LUIS to recognize the similar utterances automatically. Entities. The response of LUIS engine is a JSON structure that contains the original query and recognized ideas. Entities are basically the keys of these ideas. For example, if the query may contain product names, you need to create a Product entity. Phrase List Features. Some components of utterances are examples of the business entities like specific product or category names, colors or places. Using phrase lists significantly increase the recognition quality, because these are key components of utterances. These sets are usually countable and finite. Prebuilt entities. Such entities as dates, money, numbers, temperatures, ages are prebuilt that means that LUIS is capable of identifying them automatically (if you mark a part of utterance as a prebuilt entity).
E-Commerce and chatbotsChatbots are good for knowledge areas where a range of the possible requests or answers is limited or managed by the bot. For e-commerce, it is good for ticket sales or pizza delivery, but for broader areas, the LUIS way may not fit the expectations. It is good when a bot initiates a dialog, asking the customer about something in a very clear and concise way. It should be a direct question. The range of answers should be clearly seen. For example, if the bot asks you about your age, you will likely answer “48”, won’t you? Some people who are natural born testers may reply with “fourty eight”, but nobody will use something like “I’m in my late 40s” or “yesterday I turned 16”. However, if the customer is a first who initiates dialog, the range of possible requests is really huge. Look at the kik’s H&M bot dialog: Every step in this dialog has a limited set of possible answers. Think about using expert systems to ask right questions. For example, drools engine might be leveraged for this task. E-Commerce bots are good to give some advice or requested information to the user, but they aren’t capable following the customer through the checkout process properly. Usually, bots redirect the customer to the website if the customer wants to buy a product or service. There is too much information that needs to be shown to the customer. The chat window is too small and it has too simple UI for these purposes. Neither Microsoft Bot Framework, nor Skype is capable of receiving payments natively, without sending the customer to an external website. Facebook’s head of Messenger David Marcus announced a new feature today onstage at TechCrunch Disrupt SF 2016: now you will be able to use Messenger for payments. Now it is the turn of Microsoft to do the same with Bot Framework.
© Rauf Aliev, September 2016