メッセージの可用性を設定する

ユーザーがエージェントとの会話を開始する前に、ビジネス メッセージでエージェントのメッセージの可用性を設定する必要があります。

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

bot と人間の可用性

ボットと人間の代表の可用性を個別に指定できます。

エージェントに対するメッセージ作成の自動処理(自動返信先がキュー内の順番をユーザーに伝える、ユーザーの詳細情報に動的にアクセスする複雑な自然言語理解エージェント、またはその中間など)がある場合は、bot メッセージが利用可能であることを明記してください。

位置情報ベースのエントリ ポイントローカル以外のエントリ ポイント(Google 広告を除く)など、Google が管理するエントリ ポイントでエージェントを起動する場合は、人間が操作できる必要があります。人間の都合に合わせて、人間のエージェントが質問に答える曜日と時間のみを指定してください。

bot 担当者は毎日 24 時間体制で対応できますが、午前 8 時から午後 8 時までは対応できます。

また、bot と人間が対応できる状態の両方を指定すると、人間のエージェントによるリクエスト サジェスチョンを送信して、ボットの担当者がニーズを満たすことができない場合に、人間のエージェントに対してリクエストするように促すことができます。

メッセージの受信の可否を更新する

メッセージの可用性を更新するには、Business Communications API で PATCH リクエストを実行し、エージェントの primaryAgentInteraction フィールドと additionalAgentInteractions フィールドを更新します。

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

Prerequisites

メッセージ機能の利用を更新する前に、以下の準備が必要です。

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

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

  • bot の可用性のタイムゾーン、曜日、時間

  • 人間がいるタイムゾーン、曜日、時間

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

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

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

bot と人間によるメッセージの両方の可用性がある場合は、bot の可用性を primaryAgentInteraction に、人間の可用性を 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 をご覧ください。