I would like to know how to reset contexts in DialogFlow V2. I m currently using V2 and writing the backend codes in node.js.
Asked
Active
Viewed 1.0k times
2 Answers
13
Got the Solution Myself:- There are several ways to clear contexts:
- In a detectIntent query, you can set resetContexts to "true".
- To reset contexts when testing in the Dialogflow test console, click the 'RESET CONTEXTS' button.
- In order to reset all contexts in an intent, click on the 'X' button in the 'Contexts' section below the intent name. The contexts will be cleared after the intent completion.
- If you want to reset an individual context in the intent, set the context lifespan value to 0.
- You can also use our /contexts endpoint to perform these operations programmatically: https://dialogflow.com/docs/reference/api-v2/rest/v2/projects.agent.sessions.contexts.
- For resetting contexts via webhook, use the "outputContexts" field in the response from the web service: https://dialogflow.com/docs/reference/v1-v2-migration-guide-fulfillment#webhook_responses. Note that the contexts will be updated after the intent completion.

Abhinav Kaimal
- 235
- 1
- 2
- 10
3
It depends exactly what you mean by "reset contexts", but if you want to remove a context from being considered during the next user statement, you can set the context's lifespan to 0.

Prisoner
- 49,922
- 7
- 53
- 105