メッセージングの対応時間を設定する

ユーザーがエージェントとの会話を開始できるようにするには、Business Messages でエージェントのメッセージングの対応状況を設定する必要があります。

ユーザーが対応時間内にエージェントにメッセージを送信すると、エージェントはウェルカム メッセージと会話の開始を促すメッセージでユーザーに応答します。対応時間外に会話が開始された場合、ユーザーにはエージェントのオフライン メッセージが表示されます。これらのメッセージについて詳しくは、会話を開始する をご覧ください。

bot と人間の対応状況

bot と人間の 担当者の 対応状況を個別に指定できます。

エージェントのメッセージ作成に何らかの自動化を使用している場合(ユーザーにキュー内の位置を伝える自動応答、ユーザーの詳細情報に動的にアクセスできる複雑な自然言語理解エージェントなど)、bot のメッセージングの対応状況を指定します。

地域ベースのエントリ ポイントや 非ローカル エントリ ポイント(Google 広告を除く)など、Google 管理の エントリ ポイントでエージェントを起動する場合は、人間の対応状況が必須です。人間の対応状況については、質問に回答できるライブ対応のエージェントが対応可能な曜日と時間のみを指定してください。

bot の担当者は 24 時間対応可能で、人間の担当者は午前 8 時から午後 8 時まで対応可能な場合は、それぞれ個別に指定できます。

また、bot と人間の両方の対応状況を指定すると、bot の担当者ではニーズを満たせない場合に、ライブ対応のエージェントをリクエストするようユーザーに促すライブ対応のエージェントのリクエスト候補を送信できます。

メッセージングの対応状況を更新する

メッセージングの対応状況を更新するには、Business Communications API で PATCH リクエストを行い、エージェントの primaryAgentInteraction フィールドと additionalAgentInteractions フィールドを更新します。

これらのフィールドを更新する場合は、SupportedAgentInteraction オブジェクトのすべてのフィールドに値を含める必要があります。更新リクエストは、編集したすべてのフィールド(子フィールドを含む)の内容を上書きします。たとえば、hours にインスタンスを追加するリクエストを行う場合は、以前の hours インスタンスもすべて含める必要があります。そうしないと、更新によって上書きされます。

前提条件

メッセージングの対応状況を更新する前に、次のものが必要です。

  • 開発マシン上の GCP プロジェクトのサービス アカウント キーへのパス
  • エージェントの name(例: "brands/12345/agents/67890")

    エージェントの name がわからない場合は、ブランドのすべてのエージェントを一覧表示するをご覧ください。

  • bot の対応状況のタイムゾーン、曜日、時間

  • 人間の対応状況のタイムゾーン、曜日、時間

現在の primaryAgentInteraction 値と additionalAgentInteractions値がわからない場合は、エージェント 情報を取得するをご覧ください。

更新リクエストを送信する

エージェントを更新するには、次のコマンドを実行します。変数は、 前提条件で特定した値に置き換えます。

bot と人間の両方のメッセージングの対応状況がある場合は、primaryAgentInteraction に bot の対応状況を指定し、additionalAgentInteractions のインスタンスに人間の対応状況を指定します。

bot と人間

# This code updates the agent interaction of a bot and human representatives.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch

# Replace the __BRAND_ID__ and __AGENT_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction,businessMessagesAgent.additionalAgentInteractions" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "businessMessagesAgent": {
    "primaryAgentInteraction": {
      "interactionType": "BOT",
      "botRepresentative": {
        "botMessagingAvailability": {
          "hours": [
            {
              "startTime": {
                "hours": 20,
                "minutes": 0
              },
              "endTime": {
                "hours": 8,
                "minutes": 0
              },
              "timeZone": "America/Los_Angeles",
              "startDay": "MONDAY",
              "endDay": "SUNDAY"
            }
          ]
        }
      }
    },
    "additionalAgentInteractions": [
      {
        "interactionType": "HUMAN",
        "humanRepresentative": {
          "humanMessagingAvailability": {
            "hours": [
              {
                "startTime": {
                  "hours": 8,
                  "minutes": 0
                },
                "endTime": {
                  "hours": 20,
                  "minutes": 0
                },
                "timeZone": "America/Los_Angeles",
                "startDay": "MONDAY",
                "endDay": "SUNDAY"
              }
            ]
          }
        }
      }
    ]
  }
}'

bot のみ

# This code updates the primary agent interaction of a bot representative
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch

# Replace the __BRAND_ID__ and __AGENT_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "businessMessagesAgent": {
    "primaryAgentInteraction": {
      "interactionType": "BOT",
      "botRepresentative": {
        "botMessagingAvailability": {
          "hours": [
            {
              "startTime": {
                "hours": 20,
                "minutes": 0
              },
              "endTime": {
                "hours": 8,
                "minutes": 0
              },
              "timeZone": "America/Los_Angeles",
              "startDay": "MONDAY",
              "endDay": "SUNDAY"
            }
          ]
        }
      }
    }
  }
}'

人間のみ

# This code updates the primary agent interaction of a human representative
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch

# Replace the __BRAND_ID__ and __AGENT_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "businessMessagesAgent": {
    "primaryAgentInteraction": {
      "interactionType": "HUMAN",
      "humanRepresentative": {
        "humanMessagingAvailability": {
          "hours": [
            {
              "startTime": {
                "hours": 20,
                "minutes": 0
              },
              "endTime": {
                "hours": 8,
                "minutes": 0
              },
              "timeZone": "America/Los_Angeles",
              "startDay": "MONDAY",
              "endDay": "SUNDAY"
            }
          ]
        }
      }
    }
  }
}'

形式と値のオプションについては、 brands.agents.patchSupportedAgentInteractionをご覧ください。