Using Microsoft Bot Framework, Azure Cognitive Services and NER for Chatbots Development. Part I

And why we started talking about chatbots.

Image Description
Oleksandr Krakovetskyi 05.17.2017

Nowadays only messengers (and games) show the stable growth in active users and installs comparing to other categories of the mobile apps. WhatsApp announced one billion of active users, Facebook Messenger - 900 mln, WeChat - 700 million. Messaging apps have surpassed social networks. And this is just a beginning.

For millions of people, Facebook Messenger can be a first place, where they will face the chatbots. If they start to use them, it can become a new market for software developers - firstly after Apple company opened the App Store.

Social networks can use this sustainable growth to become new media or even beat Google in the search field. Messengers might be a good place to start. That's why the majority of popular services opened the public Bot API. Despite the fact that messengers formally give access to developers to their numerous audiences, in fact, these developers will bring their users back to messengers. But we will not emphasize much attention on the theory of conspiracy or make a philosophic judgment where it will lead us; we will concentrate more on technical aspects of the intellectual bots development.

Examples of intellectual bots lets brands to communicate with customers via messengers.

Sony Pictures replaced 70 operators with one Chabot.

19-years old developer created a free bot, which returned drivers three million US dollars for parking penalties.

Iranian bot Tina (who is also called Iranian Siri) has 2.6 million followers in Telegram.

Microsoft Xiaoice (China) - 17-years old girl, who lives in WeChat and Weibo. This bot is called the biggest Turing test in history. Chatbot can answer the questions, recognize the emotions and even emphasize.

X2AI, a startup from Silicon Valley, created a bot which helps Syrian refugees in Lebanon to solve their psychological problems because of the war.

DonorUA.Bot (available for Skype, Telegram, and Facebook Messenger) checks if you have contraindications for being a blood donor (absolute or temporary) and understands Ukrainian and Russian languages.

Sometimes intellectual bots work incorrectly, and we can observe interesting results. For example, Twitter-bot TayTweets from Microsoft which was learning on tweets sent by users. Of course, humanity cannot teach robot anything bad (sarcasm), that's why just after 24 hours bot started to write xenophobia and racist tweets.

Microsoft had to remove the bot from the public. It means that bots are just an instrument but how they will be used depends on learning algorithms and goals of their creators.

Why do we need bots?

This question is asked whenever someone starts to talk about bots. Let's discuss the advantages of bots comparing to other means of communication with users:

  1. Easy start. It is easy and quickly to develop a bot. Much easier than developing a mobile app.
  2. After development, bots are automatically available in messengers and social networks; you can spend less time and resources for marketing.
  3. It is cheaper than developing mobile apps and websites. As soon as bots work on the existing infrastructures, all you need it is a database and service that will answer the questions and propose data for the request.
  4. Dialog interface is understandable for anyone, the design of dialogs - is easier than the development of UX/UI for mobile apps or graphic design of the website.

Nevertheless, it doesn't mean that you can use bots everywhere. Users, ideally, should do 1-2 clicks to obtain the needed information, if it is needed more clicks, and then bots are not the best solution for your service.

But there are many scenarios where bots are very useful. For example, for user engagement, call-centers, ordering (pizza), for the creation of databases in specific domains (e.g. medicine or legal).

Which new markets and new opportunities bots create for developers?

  1. creation of instruments and platforms for AI/ML/NLP;
  2. creation of the bot frameworks;
  3. bot directories;
  4. bots development;
  5. automation of the business processes;
  6. marketing.

Who already joined te chatbots team? It is Telegram, Skype, WeChat, Slack, Facebook Messenger, Viber, Kik. Each of the platforms proposes their unique advantages. In Telegram, it is online bots, which can be used in the conversation with other people, but overall the capabilities of the platforms are almost the same.

Let's create a simple chatbot

The process of creation of a chatbot contains several stages:

  1. Bot registration in messenger. In Telegram we should use @BotFather, for the Facebook Messenger you have to create a page that will be a bot and associate it with the app on the developer's portal. For those who want to create bot for Skype there is a separate portal.
  2. Creation of web-service (webhooks endpoint) that will get the requests with questions and return the answers. The link for web-service should be written in the bot's settings.
  3. Write the logic of command processing (n simple cases) or structured texts with the help of NLP/ML/NER instruments.
  4. Save all dialogs and other information in the database if you want to communicate with users afterward.
  5. That's all. Test, run, use.

Telegram helps to create commands. Like for any other task for bot developing we will use BotFather:

/setcommands - change bot commands list 
OK. Send me a list of commands for your bot. Please use this format: 
command1 - Description 
command2 - Another description

In Facebook you should use Persistent Menu (under five elements):

Of course, it is not all capabilities of bots and list of interesting things is growing. Next time we will talk about Microsoft Bot Framework.

Latest Publications

News, posts, articles and more!