Every day we are asking "Hey google", "Hi google", "Please play this", do this, do that, but are we considering what's going on in the background? I made a small chatbot, named ml-bot, to find out how such a system works.
What is Dialogflow?
Dialogflow is a Google AI Service, available in multiple languages.
By using it we can easily make conversational voice or chat bots.
Recently it is getting hard to write code from scratch due to advanced and super-fast client expectations. In a business situation we might need to make a running bot example in a couple of hours or a day. This is the point when thinking about using Dialogflow. Very easy to integrate on web and mobile apps.
Advantages of Dialogflow
ML/AI is used
Easy to use
Handles the complex conversation
Available in many languages
Integration with other tools is very easy
Easy webhook integration (HTTP request events on specific action inside Dialogflow system)
Types of Dialogflow services
1. Dialogflow CX (Customer Experience)
Designed for complex flows of conversation, it uses a state machine for managing the states of conversation.
Below is an example of what a food ordering flow for a pizza delivery agent can look like. Food ordering systems are a simple example where Dialogflow CX can be used.
Image source: Google
2. Dialogflow ES (Essentials)
This is the older version of Dialogflow, which has been renamed to ES. While designing a bot, if we have simple and small agents, we should use ES.
Image source: Google
Where should I use Dialogflow?
Messaging tools like Slack are very easy to integrate with Dialogflow. See here for more details.
Voice bots can be easily made with Dialogflow, for serving all types of users, including physically challenged people.
Chat bots on any mobile app platforms (Android, iOS, Flutter etc) and some kinds of web apps. Very accurate and fast response.
What should I know before writing code or designing bots using CX?
What are Agents?
Agents are the entry point to a bot system. Agent basically interact with end users and process the information behind the system.
Example of agent - here "ml-bot" is the agent name
What is Intent?
Intent, in simple words, is what the user wants to say.
It is kind of the end user's intention. We can also combine many intents and do much more together.
Example of Dialogflow CX intents - "WecomeIntent", "No", "Yes" etc.
Example of a welcome intent on a page
The same intent can be described in the following ways:
"hi", "just going to say hi", "long time no see", "hello hi" etc.
What are Entity and Entity types?
Entity is the data taken by the user. In the below picture eggs benedict is an example of entity.
The way to fetch the user's data is called entity types. In the picture below, breakfast-type is the entity type and eggs benedict is the entity which has synonyms (eggs, Eggs, eggs benedict). Synonyms is the way the user can type his message.
What are Routes?
Routes are the way to control the flow inside a page. It is more about conditional logic in a flow.
What are Pages?
Page represents the CX session. When started, the conversation page becomes active. The flow start and end state are handled by special pages.
In the below example, "Breakfast" and "Coffee" are the pages while ordering the food in a restaurant.
Here is one example how to add a page "Order Page" and the already made pages "Breakfast" and "Coffee".
What are Parameters?
We can take the value sent by the user to the bot. These values are called parameters.
What is Flow?
Flow is a module or unit which defines the simple part of a conversation and its flow. Flow acts as a path in the conversation. In the below example, "Breakfast" is a part of conversation while ordering the food in a restaurant.
Example of the coffee flow:
What is Fulfillment - Bot response?
The response given by the bot to users is called fulfillment.
"しばらくお待ちください" (tr. "Please wait") is an example of fulfillment which the agent says after the order of the breakfast has been placed.
Dialogflow system architecture
Below is an example when the user says "Hi" to the bot. The message goes to the system and the system connects to the Dialogflow API. Then if we have a webhook, then retract with that.
And now the process goes back, the Dialogflow API returns the response by detect intent and that is returned to the system we have and finally reaches the user.
We learned about the basics of Dialogflow and its types (CX, ES). We summarized the complete guide for using Dialogflow.
Overall, we learned about making a quick chatbot (ml-bot) using the Dialogflow CX visual builder.
I asked some questions using the visual builder from my bot Ask-Me-Any-Thing.
Implementing a chatbot from scratch might take a bit of time and effort, so we might consider using the Google Dialogflow system for chatbots.
Swift Package Manager plugins are a great way of automating tasks, like, enforcing code conventions and style.
In this tutorial we're going to learn what are package plugins and implement 2 plugins; one that outputs code statistics and another that genera...
Hi, this is Bitcoin and from now on it will live with us!
Traditional money has long been outdated and is gradually losing its popularity.
In most cases, we already use electronic money.
But e-money is not much different from cash, except in form, but the...