05 How to mimic Dialogflow CX session variables in Dialogflow ES

Dialogflow ES Quickstart Templates

In the previous article I explained how you can mimic the behavior of follow up intents to move to the next intent.

One disadvantage of this approach is that you cannot access the information collected from 2 or more steps prior in the current response.

The way around this is to use the concept of session variables.

What are session variables?

In the entry intent (that is one which does not have an input context), add an output context which has a very large lifespan, like 50 or 100. You can now use this output context for the next 50 (or 100) steps in your conversation flow and access user input values


Let us take the example of the lead capture bot, and extend it to use session variables.

Add an intent called add.website.chatbot intent with the following details. Add an output context called session-vars with a context lifespan of 50

Add an intent called user.provides.name with the following details

Add an intent called user.provides.email with the following information

Add an intent called user.provides.url with the following information

The user.provides.url intent ends the conversation. So we display a thank you message and also summarize the user’s input.

Notice that I use the prefix #session-vars followed by the parameter name. That is how you can access parameters stored in the session-vars context.

However, the last parameter $url will only be added into the session-vars in the next step. So you need to just access it via the regular parameter name.

Now test the bot using the Dialogflow Messenger integration

About this website

I created this website to provide training and tools for non-programmers who are building Dialogflow chatbots.

I have now changed my focus to Vertex AI Search, which I think is a natural evolution from chatbots.


BotFlo was previously called MiningBusinessData. That is why you see that watermark in many of my previous videos.

Leave a Reply