Migrate to Dialogflow API V2 before October 23, 2019

October 23, 2018

Back in April, we announced that Dialogflow API V2, along with Dialogflow Enterprise Edition (built on API V2), became generally available to all users. API V2 now serves as the default API for all new Dialogflow agents, and we’ve been releasing new features on API V2 since then. Some of the new features include: Versions and environments for building, testing, and deploying multiple environments, and Knowledge Connectors and Phone Gateways for easily implementing content-heavy FAQs and phone numbers into your agent.

API V1 will be deprecated on October 23, 2019

As we’re building out more and more functionality for API V2, we will also be shutting down API V1 in one year – on October 23th, 2019. If your production agent is currently using API V1, it must be migrated to API V2 before this date.

See the API V1 → V2 migration guide for instructions on how to migrate, or read on for an overview of what’s required.

How to migrate from API V1 to API V2

Migrating from API V1 to API V2 affects the behavior of the Dialogflow console, APIs, and your fulfillment. You can check what parts of Dialogflow you are using here. When migrating from API V1 to API V2, please note the following:

  • If utilizing fulfillment for your agent, you must update your fulfillment code to support the API V2 request and response formats before switching to API V2.
  • All Dialogflow APIs have been redesigned and use OAuth for authentication. If you use this API directly, you need to update your client code before switching to API V2. See this guide for API V2 equivalents of API V1 methods and fields.
  • If you’re building an Action with the Google Assistant integration, see this Medium post for information on how to migrate from API V1 to API V2.

You can get started on migrating today with the API V1 → V2 migration guide. Please contact us if you need any help.

Posted by Matt Carroll, Developer Programs Engineer

Validate entities using regular expressions in fulfillment

August 23, 2018

Entities are powerful tools used for extracting parameter values from natural language inputs. Dialogflow developers use entities to retrieve important information from users, such as dates & times for appointments, locations for shipping orders, and numbers. Dialogflow already contains built-in system entities for common concepts like dates, times, numbers and more. In this post, we’ll show you how to use regular expressions to validate custom entities with fulfillment.

As an example, let’s imagine an organization has alphanumeric Employee IDs that are always six characters in length, and that the letters and numbers can appear in any position within the IDs. Here are the steps to validate if the Employee ID provided by the user complies with the format:

Let’s begin by creating an intent and adding 15-20 different Training Phrases to it. Try to add as many of the most common examples your employees might use to communicate their ID. Since we are looking for validating specific keywords associated with an entity, such words/phrases need to be identified in the user query and mapped with an entity.

In this case, even though we know the length of the ID and what it should comprise of, there is no specific format in which the letters and numbers should appear in it. Since the keyword does not comply with any predefined entity format (and it’s not possible to create a custom developer entity for this), we recommend using @sys.any as a wildcard entity here. To do that, highlight the keyword in the training phrases and choose @sys.any from the list of entities.

Since we suggest using @sys.any for this, please consider a few points in mind to improve matching accuracy:

  1. A little higher number of examples than the generally recommended number (10-15) should be provided in the intent.
  2. Avoid mapping the entire training phrase to @sys.any
  3. If possible, prompt users for confirmation before fulfilling the request.
  4. You could also consider restricting this intent with an input context, if possible.

For instance, in the screenshot below, an intent “Get Employee ID” is created and the Employee ID is annotated in the training phrases to @sys.any.


Now that we have extracted the required keyword from the user query, we need to check if it is in the expected format or not. This check would be done in the fulfillment code by comparing this keyword with the desired regex pattern. We would, therefore, need to enable webhook fulfillment for this intent. To do this, click Fulfillment at the bottom of the page to reveal the options. Choose Enable webhook call for this intent and click the SAVE button as shown in the screenshot below.


The next step involves writing the fulfillment code for the validateEmployeeID intent. This would further involve two sub-steps:

  1. Map the intent to a function: This will let the fulfillment know which block of code to trigger. You can create a map (like intentMap in the code snippet below) to associate an action handler with the name of an intent. This would indicate to the fulfillment what steps should be taken to complete the user’s request when it matches a particular intent. In our example, we have created an action handler ‘validateEmployeeID’ for the intent ‘Get Employee ID’.

    // Run the proper function handler based on the matched Dialogflow intent name
    let intentMap = new Map();
    intentMap.set('Get Employee ID', validateEmployeeID);
  2. Implement logic in the action handler to validate the length and format of the ID: In order to validate if the ID is in the correct format or not, we would need to ensure that the ID provided in the user’s request is passed onto the fulfillment. This is done with the help of parameters. Parameters are elements generally used to connect words in a user’s response, to entities. Please note that we have created one such parameter ‘employeeID’ already and its value can be extracted in the fulfillment code from the JSON request body (field name: queryResult.parameters). Once we have the Employee ID extracted in the fulfillment, we try to match it with a regex pattern specified in the fulfillment code for the required format.

Please NOTE that you would need to modify the regex pattern based on your specific use-case.

The code snippet that implements the above step looks like this:

function validateEmployeeID (agent) {
    // get the employee ID parameter from the request received from Dialogflow
    let employeeID = agent.parameters.employeeID;
    let pattern = /[^a-zA-Z0-9]/;
    if (employeeID.length !== 6) { 
        agent.add(`The length of the Employee ID should be six characters.Please enter the correct ID.`); 
    } else if (employeeID.match(pattern) !== null) { 
        agent.add(`Employee ID should have only letters or numbers. Please enter the correct ID.`); 

You can find the complete sample code for this functionality on Github. Click on the button below to try out the sample now!

Drop by Dialogflow’s Google+ community to share your feedback and subscribe to our blog for more such tutorials. We look forward to hearing from you!

Posted by Surbhee Sehgal, Partner Technology Manager, Dialogflow

Kicking off I/O ‘18 with new & improved features

May 8, 2018

Today, we’re kicking off our 2nd year at Google I/O with lots of feature releases to help you build conversational experiences faster and smarter. See them at this Thursday’s I/O talk (which will be livestreamed) and come chat with us at the Google Assistant Sandbox if you’re attending the festivities!

Get started faster with new onboarding resources

New to Dialogflow? Watch our 3-part ‘Basics of Dialogflow’ video series to learn core Dialogflow concepts such as intents, entities, contexts and fulfillment.

And for those eager to start building, quickly import one of nine fully functional Dialogflow samples, complete with fulfillment code. Click on the ‘Add to Dialogflow’ button below to try out Temperature Trivia, which demonstrates how easy it is to build an Action for the Google Assistant using Dialogflow:

Temperature Trivia
Temperature Trivia

Debug using more insights and diagnostics

As developers ourselves, we know how important it is to detect errors and to receive specific and actionable help towards resolving them. The history tool has been redesigned to cleanly display conversations between your users and your agent, and flag places where your agent was unable to match an intent. It also links to diagnostics via our new Google Stackdriver Logging integration so you can easily diagnose and quickly fix issues.

history UI

We’ve also expanded the diagnostic information shown in the test console, so you can see the raw request being sent to your fulfillment webhook and the response that your webhook sends back.

diagnostics UI

Improve NLU quality by training with negative examples

We’ve heard your feedback! Developers have been asking for our natural language understanding to ignore certain phrases that mistrigger unwanted intents. You can now improve your agent’s precision by adding negative examples as training phrases for fallback intents.

negative examples
By providing the negative example 'Buy bus ticket to San Francisco' in the Default Fallback Intent, a purchase intent will not be matched to this inquiry if the agent only sells flight tickets.

Build to more Google Assistant surfaces and environments

As mentioned on the Google Developers blog, Actions will soon be available on new Smart Displays. You can start building for these visually rich surfaces in your Dialogflow console. We’ve launched support for tables, and will be adding more multimodal options in the upcoming months.

Google Assistant Table Card UI

Also announced is the ability to test your Action with groups of users before launching publicly. See how these new release environments in the Actions Console work with your Dialogflow agents. (For all other platforms, you can also try the beta release of Dialogflow versions and environments.)

Try these out

Go ahead and give these features a try! Drop by our developer community to share your feedback, subscribe to future news & updates, and follow us on Twitter. To see what others have built, check out our case studies with KLM Royal Dutch Airlines, Domino’s and Ticketmaster.

Posted by Artem Goncharuk, Engineering Lead

Dialogflow API V2 and Enterprise Edition are now generally available

April 17, 2018

Back in November 2017, we introduced two beta releases:

  1. Dialogflow API V2: the next iteration of our developer API
  2. Dialogflow Enterprise Edition: our new enterprise offering

Starting today, both releases are out of beta and generally available. If you’re currently using API V1, take note of important migration information.

Dialogflow API V2

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. We built API V2 on Google infrastructure and incorporated the best of Google’s machine learning. Some of API V2’s benefits include Google Cloud Speech-to-Text integration, agent management, and gRPC support.

To assist with your API V2 development, we’ve updated our 7 client libraries, including Node.js, Java, and Python. We’ve also published a fulfillment library for Node.js that simplifies building webhooks, along with JSON request and response samples for use in any environment.

Dialogflow Enterprise Edition

Dialogflow Enterprise Edition, which is built on API V2, comes with Google Cloud Platform’s support and Service Level Agreement (SLA). For users that need enterprise support, check out our Enterprise blog post for more details.

Migration from API V1 to V2

We recommend that all existing agents and existing code be migrated from Dialogflow API V1 to V2, which is our most stable release. This V1 → V2 migration guide can be used as a reference. If you’re using the Actions on Google client library, migrate to version 2, which is compatible with Dialogflow API V2 and offers many additional improvements.

Stay updated with our news

In addition to today’s announcements, we’re planning a lot of new features for I/O 2018. Make sure to subscribe to our blog and follow us on Twitter, Facebook, and Google+ to stay informed!

Posted by Daniel Imrie-Situnayake, Developer Relations and Mary Chen, Product Marketing

Introducing Session Flow for visualizing conversations in Analytics

March 20, 2018

Nine months ago, we introduced the Analytics dashboard in Dialogflow to help you monitor your agent’s performance around session traffic and intent usage. Today, we’re launching a new feature in Analytics called Session Flow, an interactive visualization that maps the most common user journeys of your agent across all platforms.

session flow screenshot

The new Session Flow report can help you answer questions to improve the user experience and increase overall usage of your agent, such as:

  • Which journeys are most and least common?
  • When do exits occur across user journeys?
  • What do transitions across intents look like in conversations?

Best Buy Canada uses Session Flow to decrease its Dialogflow agent’s exit rate by 10%

Best Buy Canada uses Session Flow to better understand how users of its order-status bot journey through different intents, which intents are most popular, and where exits occur. The company also relies on this feature when running experiments to analyze how changes to its bot would affect the overall user experience. Recently, Best Buy Canada found that the exit rate for its search intent decreased by 10% after updating its fallback intent to better handle failed product searches.

Try it out

Head over to your Dialogflow console to try out Session Flow. We hope that the new feature helps you improve the user experience and increase overall usage of your agent. We’re continually working with Chatbase, the cloud service for more easily analyzing and optimizing bots, on expanding the Analytics dashboard to help you monitor and improve agent performance.

Refer to the docs for more information about interpreting Analytics and as always, let us know in our help forum if you have any questions or feedback.

Posted by Justin Kestelyn, Chatbase PMM

Subscribe Via Email

Enter your email address:

Delivered by FeedBurner


Welcome to the Dialogflow blog. Subscribe to get product updates, best practices, and tutorials directly in your inbox.


Follow us on social