Context
Need to reuse the same intent twice or more within the same bot? Set context to your flows and make sure the bot provides the right answer.
Last updated
Need to reuse the same intent twice or more within the same bot? Set context to your flows and make sure the bot provides the right answer.
Last updated
Context makes it possible to reuse the same intent in several blocks, an important feature in bot building!
To use context in an intent:
Make sure that you created intents and linked them to blocks. In this example, we'll use general_yes and general_no intents.
Open the block containing the question.
Go to the NLP section.
Under Give output context and livespan, Ccreate an output context. For this example, we will call it book_ticket with a lifespan of 1.
The lifespan designates how many times a context can be set throughout the whole conversation. For instance: If the bot offers free dessert twice in one conversation, we should put the lifespan at 2 because the user can say yes or no twice to this question. In this example, we'll only offer free dessert once, so we'll keep the lifespan at 1.
Click Save.
Open your intent block. For instance, open the general_yes intent block.
Navigate to the NLP tab.
Under Required context, look for the context that you just created. In this example it will be book_ticket.
Click Save.
Follow the same process for other places in the conversation where those intents are used. That way, you can be sure that the bot provides the right answer!
A user can have multiple contexts when navigating between different conversation flows. When multiple intents and input context combinations are found, the user's context with the highest lifespan value is taken.