Home / DialogFlow ES / Naming conventions for Dialogflow ES intents and contexts
DialogFlow ES

Naming conventions for Dialogflow ES intents and contexts

First published: Nov 2017 | Last updated: May 2022

Do you capture user input in your chatbot?

For example, do you ask them to provide their name, or email, or other information?

I have recently started using the following convention in the bots I am building (as well as advising on).

Suppose you have an intent which should get user’s email address. You can, of course, name it “EmailAddress”, but that isn’t very obvious.

“Obvious to whom?”, you might ask.

Where do you use it?

The key, of course, is where you use the intent name. It is not just the intents list view.

One use for the intent name, for example, is in the Dialogflow simulator console. Looking at the intent name, you can tell what intent was just mapped. When you receive user input, you want the intent name to convey that some input was indeed received.

Another use is when you are accessing the agent via Dialogflow’s REST API. In this case, it is even more important to have the intent be as self-descriptive as possible because often you don’t have the additional context that you sometimes get when you are inside the Dialogflow console.

A final use for the intent name is in your training and history tab. Here again, you want the intent name to be as descriptive as possible. Almost certainly, you don’t want a confusing intent name in your training tab.

Suggested intent naming convention

Here is what I suggest. Name your intent based on the action which was completed – that is, what is the conclusion you can make from that intent firing?

If you are collecting the user’s email address, you can conclude that “UserProvidedEmailAddress”. That is how specific the intent name should be.

Update: I have improved this a little bit and removed User (which is redundant) and added a period sign between each word because it is easier to read. For example, UserProvidedEmailAddress becomes provides.email.address

Suggested context naming convention

The next question is – how do we know that the intent is ready to accept an email address?

Usually, we set an output context on the previous intent which was triggered. For an intent which is supposed to collect an email address, we should have already set a context indicating that that’s what we wish to do.

So in the previous intent, set the following as the output context: awaiting_email_address

Or maybe you can use expecting_email_address.

Keeping the context name as short as possible while also keeping it descriptive is also a good idea. Once again, I have improved this to await_email_address

Follow up intent autogenerated context names

One of the big problems I have with using follow up intents is the terrible naming convention used for context names. And you cannot change the context names without breaking the hierarchy either.

As a result, merely using follow up intents leads to poor context names which are not easy to read.

Comparisons

Let us compare the follow up intent agent naming conventions to the session-vars agent naming conventions. This will make it very clear how useful these naming conventions can be.

Dialogflow Simulator

In the simulator, it is much easier to read the name of the intent which was mapped, as well as understand the state of the bot based on the currently active context.

followup agent
session-vars agent

History

Similarly, if you inspect the Raw Interaction Log inside the simulator, it is much easier to understand what happened with the suggested naming conventions.

Follow up agent
session-vars agent

Training

We can see the same benefits in the Training feature also

follow up agent
session-vars agent

Conversation Analytics

Finally, good naming conventions can be immensely helpful when doing conversation analytics.

For example, this is the output of my History JSON to CSV converter tool (which you can use to measure the accuracy of your Dialogflow bot)for the follow up agent.

And this is the output of the same tool for the session-vars agent.

As you can see, the denser the information, the more useful these naming conventions.

<— 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

    • In my view, for action, the convention that Dialogflow uses in most of its tutorials is most useful. For e.g. the default welcome is input.welcome and the Default Fallback is input.unknown. Similarly you can use X.Y to mean X = major intent category and Y = specific meaning.