設定訊息的可用性

您必須先在 Business Messages 中設定代理程式的訊息可用性,使用者才能開始與代理程式對話。

如果使用者在可用時段傳送訊息給您的代理程式,代理程式會以歡迎訊息和對話啟動條件來歡迎使用者。如果在非營業時間開始對話,使用者會看到代理程式的離線訊息。如要進一步瞭解這些訊息,請參閱開始對話一文。

機器人和人類的可用性

您可以分別指定機器人和人類代表的可用性。

如果您有針對自動化功能,為代理程式編寫訊息 (無論是以自動化功能回應使用者指出使用者要在佇列中的位置),或複雜的自然語言理解代理程式能夠動態存取使用者的詳細資料,或介於兩者之間的任何項目,都能指定機器人訊息的可用性。

如果您希望在 Google 管理的進入點啟動代理程式,包括以位置為基礎的進入點非本地進入點 (Google Ads 除外),就必須啟用人工可用性。為提供真人服務,您只能指定開放專員在一週內的哪幾天與哪些時段回答問題。

如果機器人代表提供 24 小時全天候服務,但人類代表可在上午 8 點至晚上 8 點提供服務,則可另外指定。

此外,如果您同時指定機器人和真人可用性,則可以傳送即時服務專員要求建議,在機器人代表無法滿足其需求時,提示使用者要求代理程式。

更新訊息可用性

如要更新訊息可用性,請使用 Business Communications API 發出 PATCH 要求以更新代理程式的 primaryAgentInteractionadditionalAgentInteractions 欄位。

更新這些欄位時,您必須在 AgentAgentInteraction 物件中納入所有欄位的值。更新要求會覆寫所有您編輯欄位的內容,包括任何子欄位。舉例來說,如果您提出要求,將執行個體新增至 hours,則也必須一併加入所有先前的 hours 執行個體,否則您的更新會覆寫這些執行個體。

必要條件

更新訊息可用性之前,您需要:

  • 開發機器上 GCP 專案服務帳戶金鑰的路徑
  • 代理程式 name (例如「brands/12345/agents/67890」)

    如果您不知道代理程式的 name,請參閱列出品牌的所有代理程式一文。

  • 機器人供應情形時區、星期幾和時段

  • 人工開放時區、星期幾和時段

如果您不知道目前的 primaryAgentInteractionadditionalAgentInteractions 值,請參閱取得代理程式資訊一文。

傳送更新要求

如要更新代理程式,請執行下列指令。將變數替換為您在先決條件中指定的值。

如果您同時擁有機器人和真人訊息的可用性,請在 primaryAgentInteraction 中指定機器人的可用性,並在 additionalAgentInteractions 的執行個體中指定人類可用性。

機器人與人類


# 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"
              }
            ]
          }
        }
      }
    ]
  }
}'

僅限機器人


# 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