The Context switch

To keep the context in our conversations, we will need to look for the context from previous queries. This is stored in the standard context variable called "context".

By building a context switch as a default workflow in our entity switch. We will first evaluate if there is new context to the conversation. If there is no new entity, we will run the default workflow, which is a context switch that will evaluate if there is context from a previous query.

The context switch works just like the entity switch but will look for one single variable instead of multiple entity-variables.
The variable we look for in this case is “context”. Remember, in the entity switch, the entity is stored as “context” and then thrown away as an entity when the entity switch was run.

The default workflow in our context switch is our fallback. 

When we ask the bot “How much is it”, We are not stating a “something”. There is no entity in our query.
The intent will trigger the connected response, which is the entity switch. But the entity switch will not trigger though there is no entity in the query.

So, the default workflow in the entity is triggered. This default workflow is a Context switch. The previous entity (boats), was stored in “context”.Therefore, the contextswitch for “prices” will trigger the workflow for “prices-boats”.

The "default" workflow

If I do not have an entity, nor a context variable from a previous query.

Then the chatbot would not understand what product we are asking about. This is when the default workflow in the context switch will be triggered.

So, this is the flow.

Customer queries: "I want to have information on a product"

Intent matches "Need information" without any entity. Default workflow, ContextSwitch is hit.


The default workflow in the ContextSwitch is struck. Triggering a response and some options for the customer to choose from.

If the visitor query would be "I want to have information on boats".

If we now query the bot with a new intent. "How much does it cost?"


13/03/2023 - 09:18

Last updated

28/03/2023 - 15:47