Creating Natural Language Interactions with DialogFlow (API.AI)

ItamarMItamarM RSS Feed

It’s true what they say: chatbots are changing the way in which we communicate with one another. If in the past we had to wait for hours for a service provider to get back to us, today we’ve come to expect humans and bots alike to respond to our messages immediately. Yet users still have to communicate relatively exact requests to a bot in order for it to understand the action they want it to perform. Ideally, they should be able to type naturally, without too much thought, and have the bot understand their intent.

In order to build a true conversational interface we need to look beyond simple string-command matching, and remember that the task of understanding natural language and free text conversations is not as straightforward as we’d like it to be.

Assume that you are dealing with a nutrition fact chatbot and you ask the following question:

How many calories are in a banana?

In order to answer the user’s question, the chatbot first needs to understand the input. The two main techniques to achieve this are pattern matching and intent classification. A pattern matching approach needs a list of possible input patterns, so the input above could match a pattern such as this:


What’s good about this approach is that the patterns can be read by humans, so that the input modeling phase can be somewhat straightforward. The problem, however, is that when patterns are built manually there are just too many rules to be followed.

On the other hand, an intent classification approach relies upon machine learning techniques. You need a set of examples to train a classifier that will understand the user’s intent given their input. For example, “I had a 2.5 oz chocolate bar”, “I drank 1 cup of tea and ate 1 bowl of oatmeal” or “I ate chicken soup for lunch” etc.


When the opportunity arose for Viber to work with DialogFlow, a conversational user experience platform, we were very excited about the partnership. DialogFlow (aka API.AI) enables us to build an agent, which we can deploy using the one-click integration module for Viber. Once our bot is launched, it constantly improves with machine learning and updates itself in real-time based on interactions with it. DialogFlow can do this for any bot.

For example, a user discussing their lunch with a bot, saying “I ate chicken soup for lunch,” may be resolved through the platform with an action named and a meal, in this case “chicken soup,” titled lunch.

Today we launch our integration with intent engine which allows to create conversational scenarios within minutes. For example, a user request like “I ate cream soup for my lunch” may be resolved to an action like with a product of “cream soup” and meal lunch.

Once you build your agent with DialogFlow, you can deploy it using the one-click integration module for Viber. When your agent is launched, it constantly improves with machine learning and can be updated in real-time based on user interactions.

To learn more about this partnership please check out our sample code.

Need help or found a bug? Contact us.