Home / DialogFlow ES / Do you really need that Dialogflow entity?
DialogFlow ES | Entity

Do you really need that Dialogflow entity?

Check out my courses Learn Dialogflow ES and Learn Dialogflow CX if you would like to learn Dialogflow in depth. 

This post is a response to a user question:

I have an entity called “Insurance” wich has the following values:
“Home insurance”
“Empresarial insurance”

I have too an intent tha i use to ask about de price of the insurances. The training phrases are:
“How much cost the home insurance?”
“How much cost empresarial insurance”
And other phrases like those.

The DialogFlow recognize the entities in the training phrases, but home insurance and empresarial insurance are recognized like “Insurance”. I want to know if there a way to distinguish the different values of the entity and use this entity with the value to make a corresponding response like:

If i ask about the empresarial insurance, i wish to asnwer with a specific answer for empresarial insurance.

This is an interesting question, mainly because the person asking it assumes that they need an entity for the type of insurance. (I looked up empresarial – and it means business)

The standard answer

Now, for a question like this, the typical answer is to use a webhook.

You will extract the parameter in your webhook and provide a response based on what the user asked for.

The webhook logic would be implemented like this:

If parameter value = “home insurance” send a response corresponding to home insurance

If parameter value = “empresarial insurance” send a response corresponding to business insurance

function getInsuranceCost(agent){
      const insurance_type = agent.parameters.insurancetype;
      let response = '';
      if(insurance_type == 'home'){
          response = 'The cost of home insurance is X';
      else if(insurance_type == 'business'){
          response = 'The cost of business insurance is Y';

What you can do instead

Instead of creating an entity for the two types of insurance – home and business, you can instead create two different intents. The first intent will have training phrases corresponding to home insurance, while the second intent will have training phrases corresponding to business insurance.

This means you will have as many intents as there are number of entity values – in this case, you will need two intents instead of one (one for home insurance, one for business insurance).

Why avoid using an entity

Here are some advantages of using a pure intent approach for this scenario.

Easier to reason about the agent

When you have more dynamically defined agents, it is harder to reason about them by studying the intent.

Avoid calling a webhook

In some situations, using intents instead of entities can help you avoid using webhooks altogether. This is useful as you will have fewer moving parts and potential failure points in your agent.

Avoid setting context from webhook

While it is possible to update the context of the conversation from the webhook, doing so will also make it harder to reason about your agent.

More analytics friendly

In Chatbase, you will be constructing funnels, and it is much simpler to refine/segment your funnels if you used a pure intent approach versus using entities.

More visualization friendly

If you were to create a tool to visualize your agent, it would be easier to do it if your agent is more statically defined

Do you need that entity?

So here are some questions you can ask to decide if you need an entity or you can simply use multiple intents for your use case.

How many values can the entity take?

If it is only a handful, you should try and avoid using the entity

Do you need to dynamically update the context?

To get your entity to work correctly, if you need to update the context from your webhook to design your conversation flow, you might want to consider avoiding the entity.

Will it help avoid using webhooks?

If you can avoid using webhooks (webhooks add more complexity to your agent) by using the pure intent approach, that can be a good reason to avoid the entity.


Before creating an entity just because it seems like “the standard way”, you might want to ask yourself if you really need the entity to implement your agent’s functionality. If you can avoid it, you will reduce your agent’s complexity significantly.

The BotFlo app gives you many tools which can speed up your Dialogflow bot development

This website contains affiliate links. See the disclosure page for more details. 
"The magic key I needed as a non-programmer"

The custom payload generator was the magic key I needed (as a non-programmer) to build a good demo with rich responses in DialogFlow Messenger. I've only used it for 30 minutes and am thrilled. I've spent hours trying to figure out some of the intricacies of DialogFlow on my own. Over and over, I kept coming back to Aravind's tutorials available on-line. I trust the other functionalities I learn to use in the app will save me additional time and heartburn.

- Kathleen R
Cofounder, gathrHealth
Check out my YouTube courses

Dialogflow CX Beginner Tutorial

Dialogflow ES vs CX using a Decision Tree Bot

Intro to NLU for technical non-programmers

Better Dialogflow ES Bots Using the CTFS Framework

Search the autogenerated transcripts of all my YouTube videos
In this free course, I provide some tips for managing large Dialogflow ES bots without compromising on accuracy.

Similar Posts