Rapidly build and deploy a virtual agent using Dialogflow templates

A Dialogflow agent is a virtual agent that handles conversations with your end-users. It is a natural language understanding module that understands the nuances of human language. Dialogflow translates end-user text or audio during a conversation to structured data that your apps and services can understand. You design and build a Dialogflow agent to handle the types of conversations required for your system.

A Dialogflow agent is similar to a human call center agent. You train them both to handle expected conversation scenarios, and your training does not need to be overly explicit.

Although you can build an agent from scratch, you can also get a head start by using a publicly available virtual agent template that preconfigures your agent to handle certain intents.

This tutorial demonstrates how to build an agent based on an open-source template, using as an example the Verily COVID-19 Pathfinder virtual agent template. This template sets up your agent to conduct screenings and answer frequently asked questions, based on the latest Centers for Disease Control (CDC) guidance. The agent can help people stay informed and take proper steps to protect their health during the spread of COVID-19.

Building the agent

Download the template files

From GitHub, download the Verily COVID-19 Pathfinder virtual agent template and its associated fulfillment code.

Create your agent and import the template

  1. Create a new agent.
  2. Click the settings settings button.
  3. Select the Export and Import tab, then click the Import from Zip button to import the template you downloaded above.

  4. Click Fulfillment in the left sidebar.

  5. Toggle the switch to enable the Inline Editor.

  6. Follow the instructions on the screen to enable fulfillment via Cloud Functions and enable billing for the Cloud project.

  7. Go to the Google Cloud Console and select Cloud Functions on the left panel.

  8. Select the fulfillment for the function you created and click the Edit button.

  9. Under the Source code section, select ZIP upload and upload the fulfillment zip file you downloaded above. Select a Stage bucket (you may need to create one if it hasn't been created yet).

  10. Follow the instructions in the Google Maps Platform quickstart to enable the Google Maps Places API. Select API & Services > Credentials in the console to create an API key for calling the Places API (See Get an API Key for more information).

  11. Set the GOOGLE_MAPS_API_KEY environment variable to the provided API key. See Updating environment variables for more information.

  12. To use metrics for COVID-19, enable the BigQuery API by selecting your project and agreeing to the terms of service.

Interacting with your agent

Using the Dialogflow Console Simulator

  1. Type your text query input in the Dialogflow Simulator.

    Note that the custom payload of responses may not show up on the Dialogflow Console.

Using Dialogflow Messenger

  1. Go to the Dialogflow Console.
  2. Select your agent.
  3. Click Integrations in the left sidebar menu.
  4. Enable the Dialogflow Messenger integration.
  5. Paste the embed code shown on the dialog in a webpage on your website. To interact with the agent on your site, click the icon at the bottom right, type your input query, and press Enter. The agent responds.

  6. Customize the agent to appear the way you want it.

Using the Dialogflow API

To interact with your agent using the Dialogflow API, ensure that your Google Cloud Platform project is properly set up, then submit a natural language query about COVID-19 and detect its intent.

  1. Create a request.json file that includes a natural language query about COVID-19. For example:

      {
       "query_input": {
          "text": {
              "text": "how to get tested",
              "language_code": "en-US"
            }
         }
       }
       

    See the detectIntent page for details about the JSON format.

  2. Run the following command to send a detect intent request to your agent.

       curl -X POST 
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token)
    -H "Content-Type: application/json; charset=utf-8"
    -d @request.json
    https://dialogflow.googleapis.com/v2/projects/project-id/agent/sessions/session-id:detectIntent

Integrate your agent with third-party telephony and IVR platforms

Dialogflow has integrated with various telephony conversation platforms such as SignalWire and Audiocodes. You can follow the instructions on the Integrations page to set up an integration for each platform.