Home / DialogFlow ES / Why you need to add an input context to (nearly) all your intents
DialogFlow ES

Why you need to add an input context to (nearly) all your intents

[su_note note_color=”#e0e0e0″]

This article is meant for multi-turn conversation bots. If you are building a simple FAQ bot which answers questions and doesn’t get any followup questions, it doesn’t apply in that case.


On my website there is a SupportBot.

Since I have hooked it up to Chatbase, I can create funnels for different conversation paths.

Coaching Funnel

Here is a possible path that the user could take. In this case, the funnel tells me how many people (out of those who start chatting) are interested in coaching services.

For the purposes of this discussion, the last step in the funnel could be any action that you might want the user to take.

Here is my question:

How can you be confident that the percentage (here 3.6%) is a reasonably accurate representation for the number of people who reach the end of the funnel?

False positives

First, we should consider false positives. This is the case where Dialogflow maps someone as being interested in coaching even when they are not. The user could have typed a phrase which wasn’t really about coaching, but still Dialogflow picked it up as the intent where they indicate interest in Coaching (the last one marked EOC_UserInterestedInCoaching)

False negatives

Next, we should consider false negatives. This is the case where the user does type a phrase indicating they are interested in coaching, but Dialogflow doesn’t recognize it. In this case, your overall funnel “conversion rate” would actually be higher than what is being reported.

The role of input contexts

Suppose you set an input context for an intent. In the case of the final intent in this funnel, it happens to be awaiting_service_choice.

Here is what you can infer:

  • this intent will not be invoked unless the awaiting_service_choice context is already set
  • unless the previous intent sets the awaiting_service_choice as the output context, this intent will never get mapped

They are two sides of the same coin, but you need to keep this in mind for my further explanations.

Competing intents

In a previous article, I introduced the idea of the intent candidate list.

This is basically all the intents that could theoretically fire when a user types a phrase.

Note that, an intent with no input context is a selection candidate for every step of the conversation.

This is quite an important point, and sometimes overlooked. And often, people who don’t understand this concept clearly are also the ones who are surprised that Dialogflow mapped an intent that they never expected. (Truth is, while Dialogflow can sometimes be inexplicable, the majority of times it is following a very predictable set of rules, and you can reason precisely about your chatbot a whole lot more than you might think).

Minimize competing intents

Here is your goal if you want Chatbase-friendly bots:

Minimize competing intents at every step of your conversation

In practice, these are some steps which help:

  • assign an input context to ALL your intents (except for Default Welcome and Default Fallback)
  • don’t overload your Default Welcome with unnecessary user says phrases (that is, avoid adding domain specific words into your Default Welcome intent)
  • don’t set a context lifespan of more than 1 for your output contexts (can you see why?)
  • it follows that most of your intents should set an output context (unless they are end-of-conversation intents)
  • for intents which share the same input context, try to aim for as much inter-intent variation as possible

Having discussed these options, you should remember that it isn’t enough to take the steps above if you want to minimize false positives and false negatives to as low as possible. For that, you also need to put more thought into how you design each intent.

In my “Conversation Design” course, I teach you many tips which will help you design your intents in such a way that you can reduce both false positives and false negatives. (In particular, the chapter on “Dissecting Intent Mapping” gives you tips on reverse engineering how Dialogflow does its intent mapping. Learning about this will immediately improve the intent mapping accuracy of your bot).

<— End of article —>

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
"Much clearer than the official documentation to be honest"

Thanks a lot for the advice (of buying and following your videos)! They helped a lot indeed. Everything is very clear when you explain, much clearer than the official documentation to be honest 🙂

Neuraz T
Review for Learn Dialogflow CX
"I will strongly recommend this course because even I can learn how to design chatbot (no programming background)"

I think Aravind really did a great job to introduce dialogflow to people like me, without programming background. He organizes his course in very clear manner since I have been a college professor for 20 years. It is very easy for me to recognize how great Aravind’s course is! Very use-friend and very easy to follow. He doesn’t have any strong accent when he gives the lectures. It is so easy for me to understand. Really appreciate it.

Yes, I will strongly recommend this course because even I can learn how to design chatbot (no programming background) after studying Avarind’s course, you definitely can!

Ann Cai
Review for Learn Dialogflow ES

Similar Posts