Using the V2 API

Dialogflow's V2 API is in beta and is currently available to anyone who wants to try it out. This guide will cover how to create an agent with V2 enabled, as well as how to convert existing V1 agents to use the V2 API.

Keep in mind, as a best practice you should always export production versions of agents before making changes.

Changes in V2

Here are the high-level changes you can expect and should be aware of when moving to V2 of the API:

  • How agents are accessed via the API, both at runtime and designtime.
  • New Webhook API protocol.
  • How one-click integrations call Dialogflow - This shouldn't affect you, as the changes are on our end.
  • JSON object shown in the test console - Again, this shouldn't affect you but it does change how the JSON looks.
  • Authentication through Service Account or OAuth - See Authentication setup.

Creating a new agent that uses V2

  1. In the agent list, click on Create new agent.
  2. Enter the desired information for the agent.
  3. Toggle the switch under the API VERSION section. Blue means the setting is enabled.
  4. Click the Save button.

Enabling V2 in an existing non-production agent

  1. Click on the gear icon, to the right of the agent name.
  2. On the General tab, toggle the switch under the API VERSION section.
  3. Click the Save button.

Enabling V2 in an existing production agent

Export current agent

  1. Click on the gear icon to the right of the agent name.
  2. Click on the Export and Import tab.
  3. Click the EXPORT AS ZIP button.
  4. Save the resulting ZIP to your system.

Create a new agent that uses V2

  1. In the agent list, click on Create new agent.
  2. Enter the desired information for the agent.
  3. Toggle the switch under the API VERSION section. Blue means the setting is enabled.
  4. Click the Save button.

Import the ZIP file

  1. Click on the gear icon to the right of the agent name.
  2. Click on the Export and Import tab.
  3. Click on the RESTORE FROM ZIP button.
  4. Navigate to the ZIP file you saved to your system, and confirm.