Google Chat

Dialogflow CX's Google Chat Integration lets you create Google Chat apps with natural language understanding based on Dialogflow CX technology.

Limitations

Set up Google Chat

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

Enable the Google Chat API

Before using Google APIs, you need to turn them on in a Google Cloud project. You can turn on one or more APIs in a single Google Cloud project.

  1. In the Google Cloud console, enable the Google Chat API and the Dialogflow API.

  2. Confirm that you're enabling the APIs in the correct Cloud project, then click Next.

  3. Confirm that you're enabling the correct APIs, then click Enable.

Set up from Dialogflow CX

  1. Go to the Dialogflow CX Console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Integrations in the left sidebar menu.
  6. Click Connect on Google Chat.
  7. Fill in the following required information:
    • Name: The name which is displayed to users who interact with or consume content created by this app, such as in messages, search, and @mentions. For example Dialogflow CX App.
    • Avatar URL: The avatar image which is displayed to users who interact with the app. Specify an HTTPS URL that hosts a square (aspect ratio of 1:1) PNG image. Recommended minimum size: 256 by 256 pixels. For example https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png.
    • Description: A description of the app. For example, A helpful bot that responds to real human conversation.
  8. Choose an Environment as applicable.
  9. Enter email addresses to make this Chat app available to specific people and groups as applicable.
  10. Click Start.

Testing

To test your configured app, mention it in a Google Chat space or send it a DM. For example,

  1. Open Google Chat.
  2. Click New chat.
  3. In the Add 1 or more people field, type the name of your Chat app.
  4. Select your Chat app from the results. A direct message opens.

Rich response messages

The rich response messages are supported using Custom Payload in Fulfillment. 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.