Entities
Words within phrases could have different meanings or values and these words are known as Entities. Dialogflow provides a number of built-in Entities with pre-existing values for things like countries, states, cities, currencies, dates, and more. In this example, the same phrase triggered a different response, because the phrase contained Dialogflow's built-in country Entity which stores values for every country in the world. The user input value is automatically stored in Chatfuel and you can create conditions in your Flows with the values.
When you add a training phrase to a Dialogflow Intent, it may automatically trigger an entity, or you can just highlight the word and select an entity. In this example, just mentioning any country in a phrase will trigger @sys.geo-country, Dialogflow's built-in "System Entity" for countries.
When a Dialogflow Entity is triggered it will create a Dialogflow Parameter which will store the value you capture from the user's message which triggered the Entity. Here you can see the phrase triggered the @sys.geo-country Entity and created the geo-country Parameter.
You'll want to create a User Attribute in Chatfuel that matches the Parameter Name in the Intent, or if you trigger the Intent by sending a message, Janis will automatically create the User Attribute for you. As long as your User Attribute names match the Parameter Name in Dialogflow, then the value will automatically get stored in Chatfuel!
In short, Parameters get created in Dialogflow when your training phrases trigger Entities and Parameter values automatically get stored as User Attribute values in Chatfuel. You can use Dialogflow to understand messages and possible values inside of phrases and use those values to add smarter blocks Chatfuel.
Create your own Entities
If you click into the Entities tab in Dialogflow you can create your own Entities so you can trigger them when adding phrases to Intents.
In this example, a custom Entity was created called job-types and it contains a list of different jobs. If a user is looking for a job, they might say "I'm looking for an accounting job in New York", and if "accounting" is a value in an Entity, it will automatically trigger the Entity when you add the phrase to the Intent.
You'll want to add similar words as values and group them into Entity and add synonyms for each value too. You might not only have an Entity for different types of jobs, but an Entity for the word "Jobs" itself.
If you create an Intent for job searching and you add phrases you can see how the phrase will trigger the Entities you create.
As long as the User Attributes match your Parameter names in Dialogflow, the values will get stored in Chatfuel.
While you'll likely want to create your own Entities, here are some common built-in Dialogflow Entities ("System Entities") that you can save as Chatfuel User Attributes.
@sys.date-time | Will extract both the date and time in a phrase (i.e. Thursday at 2pm). |
@sys.date | Will extract a date in a phrase. This can be ambiguous (i.e. "tonight", or "in 2 weeks" ) or specific like "May 5th", or "Christmas Day". |
@sys.number | Will extract a number from a phrase. |
You can view a complete list of Dialogflow's built-in System Entities here.
Entities and Messenger's Blue Thumbs Up
One of the most common user inputs in Messenger is the “Thumbs up” built into the Messenger interface. This object is not a traditional unicode emoji. Just like the other stickers built into Messenger, the Thumbs up is a .PNG image file. When users send this input to your bot you’ll need a way to train your bot to respond. Read this tutorial on how you can train Dialogflow to respond to the thumbs up sticker in Messenger by creating a special thumbs up entity.