How to replicate contexts in Dialogflow CX?

I got this question on my YouTube channel:

I have a question about the context equivalent in CX. In ES, there was a concept of contexts. How can we achieve the same in CX? I tried one way with using condition routes with page transitions and it worked in a way. But are there other ways?

First of all, the approach mentioned by the reader is correct. But it isn’t the full picture. There are some things you can do in CX which aren’t really possible in ES. For example, the concept of session variables is built into CX, so there is no need to explicitly declare a context for that in your CX chatbot. Similarly, fallbacks don’t push your conversation into an unexpected state, so you don’t have to worry quite as much that your conversation might go off track. Explicit retry handling inside CX slot filling means that it is not a problematic feature like it was in Dialogflow ES.

I will also add a few more notes to complete this picture.

In ES, you can use input and output contexts to manage the state of the conversation, but it is quite tedious. But Dialogflow CX is a ground-up rewrite of Dialogflow, and uses the state machine as a fundamental primitive. So creating state machine based conversation flows is much easier in Dialogflow CX.

In practice, this is what it means – you should try to use CX only after you identify the state machine in your conversation flow. This might sound complex, but my beginner tutorial can help you get started with this. Also, remember that your chatbot might not even need Dialogflow CX.

Once you build your state machine/conversation flowchart, then just use CX features and forget about input and output contexts.

For example, in my Learn Dialogflow CX course, I show how to convert an existing ES bot which uses input and output contexts (the decision tree chatbot) into the equivalent CX bot.

This is a part of the flowchart for the ES bot:

And this is the equivalent transition route for CX:

Summary

1 You need to understand how state machines work

2 In my opinion, creating a flowchart in Mindomo helps you create your bot in CX more easily

3 Look for places where you can reuse intents in Dialogflow CX

4 Use conditional expressions so that you can add more logic into the conversation layer


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.

Note

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

Leave a Reply