Google Chat

Dialogflow's Google Chat Integration allows you to easily create Google Chat apps with natural language understanding based on Dialogflow technology.

Limitations

Set Up Google Chat

In order to set up the Google Chat integration for your agent, you'll need the following:

  • A Google Cloud project

Create a Google Chat app

  1. Navigate to your Google Cloud project
  2. In the Google Cloud console, enable the Google Chat API
  3. Navigate to the Google Chat API configuration page (Menu > APIs & Services > Enabled APIs & Services > Google Chat API > Configuration)
  4. Fill in the configuration information (name, avatar url, description, etc), as applicable
    • Make sure to enable interactive features

Set up Dialogflow

  1. Click Manage tab on the left panel.
  2. Click Integrations in the left menu.
  3. Click the Connect button on the Google Chat tile.
  4. Choose an environment, as applicable.
  5. Click Start.
  6. Copy the Webhook URL.

Enable webhook in Google Chat

Return to your Google Chat API configuration page and paste your webhook url under Interactive Features > Connection settings > App URL

Testing

To test your configured app, add it to a Google Chat space or send it a DM.

Rich response messages

The rich response messages are supported via Custom Payload in Fulfillment. Please see Google Chat message API for the message format.

Text message

The following custom payload provides a Google Chat text message:

{
  "text": "Hello, world"
}

Card message

The following custom payload provides a Google chat card message:

{
  'cardsV2': [{
    'cardId': 'createCardMessage',
    'card': {
      'header': {
        'title': 'A card message!',
        'subtitle': 'Sent from Dialogflow',
        'imageUrl': 'https://developers.google.com/chat/images/chat-product-icon.png',
        'imageType': 'CIRCLE'
      },
      'sections': [
        {
          'widgets': [
            {
              'buttonList': {
                'buttons': [
                  {
                    'text': 'Read the docs!',
                    'onClick': {
                      'openLink': {
                        'url': 'https://developers.google.com/workspace/chat'
                      }
                    }
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  }]
}

Channel-specific responses

When configured, channel-specific responses with channel DF_CX_GOOGLE_CHAT will be automatically used when the agent responds to Google Chat messages.