Google Chat

Dialogflow CX の Google Chat の統合により、Dialogflow CX テクノロジーを基盤とし、自然言語理解を備えた Google Chat 用アプリを作成できます。

制限事項

Google Chat を設定する

エージェントの Google Chat 統合を設定するには、以下が必要です。

Google Chat API を有効にする

Google API を使用する前に、 プロジェクトで有効にする必要があります。 Google Cloud 1 つの Google Cloud プロジェクトで 1 つ以上の API を有効にできます。

  1. https://console.cloud.google.com/で、Google Chat API と Dialogflow API を有効にします。

  2. 正しい Cloud プロジェクトで API を有効にしていることを確認し、[次へ] をクリックします。

  3. 正しい API を有効にしていることを確認し、[有効にする] をクリックします。

Dialogflow CX から設定する

  1. Dialogflow CX コンソールに移動する。
  2. プロジェクトを選択します。 Google Cloud
  3. エージェントを選択します。
  4. [Manage] タブを選択します。
  5. 左側のサイドバー メニューで [Integrations] をクリックします。
  6. [Google Chat] で [Connect] をクリックします。
  7. 次の必須情報を入力します。
    • 名前: メッセージ、検索、名前リンクなどで、このアプリで作成されたコンテンツを操作または消費するユーザーに表示される名前。例: Dialogflow CX App
    • アバターの URL: アプリを操作するユーザーに表示されるアバター画像。正方形(アスペクト比 1:1)の PNG 画像をホストする HTTPS URL を指定してください。推奨最小サイズ: 256 × 256 ピクセル。 例: https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png
    • 説明: アプリの説明。例: A helpful bot that responds to real human conversation
  8. 該当する環境を選択します。
  9. 必要に応じて、特定のユーザーとグループがこの Chat アプリを使用できるようにするメールアドレス を入力します。
  10. [開始] をクリックします。

テスト

構成したアプリをテストするには、Google Chat スペースでアプリをメンションするか、DM を送信します。たとえば、

  1. Google Chat を開きます。
  2. [チャットを新規作成] をクリックします。
  3. [1 人以上のユーザーを追加] フィールドに、Chat アプリの名前を入力します。
  4. 結果から Chat アプリを選択します。ダイレクト メッセージが開きます。

リッチ レスポンス メッセージ

リッチ レスポンス メッセージは、フルフィルメントカスタム ペイロードによってサポートされます。メッセージの形式については、 Google Chat メッセージ API をご覧ください。

テキスト メッセージ

次のカスタム ペイロードは、Google Chat テキスト メッセージを提供します。

{
  "text": "Hello, world"
}

Chat アドオンを使用している場合、次のカスタム ペイロードは Google Chat テキスト メッセージ を提供します。

        {
            hostAppDataAction: {
              chatDataAction: {
                createMessageAction: {
                  message: {
                    text: "Your pizza delivery is here!"
                  }
                }
              }
            }
        }

カード メッセージ

次のカスタム ペイロードは、Google Chat カード メッセージを提供します。

{
  'cardsV2': [{
    'cardId': 'createCardMessage',
    'card': {
      'header': {
        'title': 'A card message!',
        'subtitle': 'Sent from Dialogflow CX',
        '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'
                      }
                    }
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  }]
}

Chat アドオンを使用している場合、次のカスタム ペイロードは Google Chat カード メッセージ を提供します。

{
  "host_app_data_action": {
    "chat_data_action": {
      "create_message_action": {
        "message": {
          "cardsV2": [
            {
              "card_id": "basic1",
              "card": {
                "header": {
                  "title": "This is a card!",
                  "subtitle": "Sent from Conversational Agents (Dialogflow CX)",
                  "imageUrl": "https://developers.google.com/chat/images/chat-product-icon.png",
                  "imageType": "CIRCLE"
                },
                "sections": [
                  {
                    "widgets": [
                      {
                        "buttonList": {
                          "buttons": [
                            {
                              "text": "Open Google!",
                              "color": {
                                "red": 0.101960786,
                                "green": 0.4509804,
                                "blue": 0.9098039
                              },
                              "onClick": {
                                "openLink": {
                                  "url": "http://google.com"
                                }
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                ]
              }
            }
          ]
        }
      }
    }
  }
}

チャネル固有のレスポンス

構成すると、エージェントが Google Chat メッセージに応答するときに、チャネル DF_CX_GOOGLE_CHATチャネル固有のレスポンスが自動的に使用されます。