Google Dialogflow is a powerful tool to build chatbots and conversational interfaces. Once you start using the Dialogflow, you will begin to acknowledge Google’s AI’s power. You can stick together a stream of potential questions your users ask and their answers. More importantly, you can also extract and use named entities such as names, cities, countries, and fruits.
Let’s see how we can do that in this post.
Power of Entities in Dialogflow
Dialogflow provides predefined system entities that can match many common data types. For example, there are system entities that match dates, times, colors, email addresses, and so on.
You can also create your own custom data matching entities. For example, you could define a fruit entity that could match the types of fruits available to purchase with a grocery store agent.
The following tutorial will show how to extract names in Dialogflow and use them in the conversation. This will enable your chatbot to identify the users’ names and reply to the user by their names.
With the help of the Kommunicate user interface, I will demonstrate how the conversation flow works. Please check the link to find out how to integrate Kommunicate with Dialogflow.
How to Extract and Use Usernames in Dialogflow Chatbots?
Words within phrases could have different possible values, and instead of creating different phrases for each name, possible values for a name would be grouped into an entity. This will also enable the backing AI to identify more such names by self-training and repeated use.
First, create a new Intent to get a user name.
Provide training phrases for this intent. DialogFlow will recognize parts of the phases that contain the names. Since Dialogflow has an inbuilt system entity for identifying names. You can see the name annotated and highlighted.
In this case, the entity will be @sys.given-name, and we’ll refer to it as $given-name.
The entity @sys.given-name consists of tonnes of English and non-English user names and should be sufficient for you. If you want to diversify the list, you can create your own custom entity with more names.
Just navigate to the Entity section in Dialogflow and click the Add button and add your list of names here. Note that, before adding the custom names, you need to map the new entity to @sys.given-name. See the following image:
Now, check conditions with Custom User Fields using Parameter Values captured or not captured when users trigger a Dialog Flow Intent.
Set the default response with the parameter value for the intent you have created and save the changes. Now the chatbot can recognize and remember the names of users and greet them with their names.
The saved changes can be tested on the Kommunicate chat widget and they will look like this:
In this way, you can easily extract names in Dialogflow and use them. This will make the chatbot interactions more personalized for a better customer experience.
At Kommunicate, we are envisioning a world-beating customer support solution to empower the new era of customer support. We would love to have you on board to have a first-hand experience of Kommunicate. You can signup here and start delighting your customers right away.