9

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.

Abhinav Kaimal
  • 235
  • 1
  • 2
  • 10

2 Answers2

13

Got the Solution Myself:- There are several ways to clear contexts:

  1. In a detectIntent query, you can set resetContexts to "true".
  2. To reset contexts when testing in the Dialogflow test console, click the 'RESET CONTEXTS' button.
  3. 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.
  4. If you want to reset an individual context in the intent, set the context lifespan value to 0.
  5. 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.
  6. 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