This will be the third and last part in my series about (Skype) bots. This time, I will explain how I used the knowledge gained from building the game bot, to create a more productive bot. One that integrates with the Sales Cloud and Service Cloud and moreover, one that does not require precize commands, but instead uses in an attempt to interpret natural language.

Bot Framework V3 

While building the dedicated Skype bot as described in my previous blog, Microsoft was working on a new version of the Bot Framework, version 3. The major difference between the version I spoke about in the previous blog and version 3 is a unified messaging format across multiple channels. This allowed the introduction of the UniversalBot in the Node.js framework. UniversalBots can operate across multiple different channels (e.g. Skype, Facebook, Telegram etc.), without specialized logic for each channel. Along with this major improvement, the framework now had its own (embedded) Skype account; no more need to sign up for a separate Skype account and connecting it to the framework.

The framework upgrade, which has evolved to 3.3 in the meanwhile, also had a big impact on the channels' software. Skype clients received several upgrades recently, specifically aimed at preparing Skype for bots. One of the majore changes in Skype is the possibility to add Skype bots to chat groups. In these groups, participants can address the bot directly, using an '@'-mention syntax. Previously, using bots in groups was impossible.

My previous bot was a so called "CommandBot". The major downside of command bots is the fact they only anticipate certain precize commands, for example "search xxx", "find yyy" or "create zzz". Any typo's in the commands by the user, or synonyms for the commands that are not programmed explicitly into the bot will not be recognized (e.g. "look up xxx"). For a user-friendly bot this is a major problem, since it would require a lengthy manual for the more comprehensive bots, so that the user knows how to operate it. For my bot, I wanted to leverage some more intelligent message handling. For this, the framework offers a special type of Dialog... the IntentDialog. An IntentDialog can implement a model. is an initiative that attempts to understand natural language uttered by a user. A Luis model generally consists of 2 important parts:

  • Intents - A definition of the user's reason for speaking (with the bot). For example: Asking a question, offering information, ordering a product.
  • Entities - The specific topic of the forementioned intent. For example, respectively: The question's topic, the information scope/details, the concrete product of interest. 

Take for example, the following phrase: "I want to order 2 pizza's". The intent of the user uttering this phrase is clearly the ordering of a product. The entities in this phrase could be "2" and "pizza", the quantity and the specific product. models allow parsing utterances in this way. Moreover, the model can be trained to improve it's accuracy.

All of this can be configured in a very decent user interface (see screenshot below). The final model is published as a REST webservice and can be used by the bot framework's IntentDialog to recognize patterns in the user's communication with the bot and to have the bot respond to them in a smart way.

On the screenshot to the right (click to enlarge), you will see a sample model I used for the integration with the clouds. The scenario is that of an insurance company, using the bot for 3 things: Reporting vehicle damage, requesting information, expressing concrete interest in an insurance product.

This mapped to 3 intents in the Luis model:

  • ​Damage Report: When the insured user wants to report (car) damage through Skype
  • Concrete Interest: The user wants to buy 1 of the company's products
  • Question: The user requests information

The following entities are implemented in the model:

  • Damage Report Item and Damage Report Location (for intent Damage Report): This entity is used to recognize the vehicle that suffered the damage (car, motorcycle or motorhome) and the location where the damage occurred.
  • Interest Item (for intent Concrete Interest): The entity used to recognize which product the user wants to buy.
  • Question Topic (for intent Question): The topic a user want information about.

Along with these self-defined entities, the pre-built entity datetime is used to capture the time of the accident that caused the damage in a Damage Report scenario. The datetime entity can be used to query for a date, in a very flexible way. The entity will recognize the date accurately from a wide variety of utterances, for example "Yesterday morning", "Tuesday 6pm, 2 weeks ago", "Last month", "5 minutes ago" and many other fuzzy variations of a date/time. offers several of such pre-built entities.

Using this model, combined with Jsforce and the bot framework, implemented on version 3 of the bot framework, a very flexible bot arose. It can operate on many channels (not just Skype), it has a simple set-up, only the Microsoft Application ID and the Bot Framework accounts are needed now (no more separate channel accounts), pointing to 1 endpoint, with generic logic built in Node.js. Generic in the sense that no specific code is necessary to implement a specific channel, as used to be the case before. 

The outcome; a Skype bot creating Cases and Leads and serving Knowledge from Salesforce, as shown on the screenshot below. Not drawn is the feedback Salesforce sends to the bot using the "Direct line"  which is available in the Bot framework. It's basically a REST webservice to call the framework from external systems. This allows for one of the coolest features of the orchestration: Salesforce pro-actively commanding the bot (through webservice calls) to send messages to the users. For example to notify them when their damage report has been taken care of, or when a support employee has started working on the Case. 

Although I could write a lot more about the possibilities bots offer, I hope the blog series have already planted some seeds of inspiration in the readers, like working on bots did in me. Very powerful technology indeed. I am hoping to see a Chatter channel available on the Bot Framework soon :)

Below is an example of a conversation between myself and the bot.

For a demo of Skype bots, or more information about the capabilities, feel free to contact me.

Add comment

Security code