On April 17, 2018 version 2 of the API . It marked the end of a beta phase that started back in November 2017. Dialogflow was made generally available Our API V2 now serves as the default API for all new Dialogflow agents, and all new feature upgrades will only be released for API V2. I remember reading the above in the announcement blog post, telling myself to upgrade my “ ” Google Assistant bot as a way to learn about the new API. Last weekend, I did exactly that and this blog post explains my approach. I Owe You Target Audience The main focus of this post is on the migration from an existing Dialogflow project that uses v1 of the API to the new API v2. If you’re new to Dialogflow, I recommend to get started with it contains the necessary steps to create a Dialogflow project. You won’t need to read the rest of this article since v2 is now the default API version. https://dialogflow.com/docs/getting-started/basics, API V1 I originally started with an “ ” project, which means my project directory structure looked like this: Actions on Google .firebasercfunctions├── index.js└── package.json The file contained the fulfillment logic for my bot, similar to the following: index.js // index.jsconst App = require("actions-on-google").DialogflowApp; const welcome = app => {app.ask('Welcome! How can I help you today?');} exports.iOweYou = functions.https.onRequest((request, response) => {const app = new App({ request, response }); // Create the action maplet actionMap = new Map();actionMap.set('input.welcome', welcome);// ... custom actions added here app.handleRequest(actionMap);}); As a visualization, the API v1 setup looked like this: Migration Guide If you’re in a similar situation as me and want to upgrade to v2, I highly recommend reading the official migration guide at . https://dialogflow.com/docs/reference/v1-v2-migration-guide My bot doesn’t have an integration to Slack, Skype, or any of the other integrations Dialogflow supports. All I had to migrate was the fulfillment endpoint. There is specifically for this use case and it lists the necessary steps. If your bot has an integration enabled, please refer to the official migration guide for details. a chapter in the migration guide In summary, migrating a fulfillment endpoint requires you to create a new agent, import the v1 agent (so you don’t have to create intents, entities, etc. from scratch), enable v2 on the new agent, upgrade your fulfillment code, test it all, release to production. In the v2 test agent, the fulfillment webhook URL needs to point to a new endpoint, the one we are going to migrate to v2. Open Dialogflow, select your v2 test agent and click on “Fulfillment” in the navigation. In the webhook’s URL field, append to the already populated URL. V2 By now, we have a v2 agent we can use for testing that points to a v2 fulfillment endpoint. What’s missing? The actual v2 of the fulfillment endpoint. Let’s start with a diagram: The main file exports two functions. One is the original that serves production traffic and the other one is a version that is used by the new test agent we upgraded to the Dialogflow API v2. index.js iOweYou iOweYouV2 To keep things organized, I suggest you extract the v1 code into a separate file and create an file for the new code. index-v1.js index-v2.js Dialogflow Fulfillment Library Beta As part of that migration, I decided to take advantage of this new Node.js fulfillment library. You can read more about it and see examples at . https://github.com/dialogflow/dialogflow-fulfillment-nodejs While the “I Owe You” bot currently only supports Google Assistant, using the fulfillment library is a great starting point to enable integrations to 8 chat and voice platforms in total down the road. API V2 Once is ready and well tested, it’s time to migrate the production traffic to the new API. Given the separation of v1 and v2 fulfillment code in individual files, migrating the production traffic to v2 is simple. The following diagram outlines what’s required: index-v2.js The steps include: Make sure the exported property loads the index file. iOweYou -v2 In Dialogflow, open your production agent and switch to the API v2. I suggest you run it like that for a while, monitor the logs and if anything goes wrong, revert step 1 and 2 above to roll back to the v1 implementation. At this point, the bot in production runs on the Dialogflow API v2. Once you’re satisfied and see no errors or drop offs in your conversations, it’s safe to clean up the code and remove the file. At this point you can also remove your test agent in Dialogflow. index-v1.js Simple, isn’t it? If you have any questions or suggestions, please leave a comment and I’ll get back to you.