設定訊息可用性

使用者必須先在 Business Messages 中設定服務專員的訊息服務時間,才能與服務專員展開對話。

如果使用者在服務時間內傳送訊息給服務專員,服務專員會向使用者傳送問候語、歡迎訊息和對話開頭。如果對話開始時間不在服務時間內,使用者會看到服務專員的離線訊息。如要進一步瞭解這些訊息,請參閱「開始對話」一文。

機器人和真人服務時間

您可以分別指定機器人和真人代表的服務時間。

如果自動化系統會為服務專員撰寫訊息 (無論是自動回覆系統告知使用者在佇列中的位置、可動態存取使用者詳細資料的複雜自然語言理解服務專員,還是介於兩者之間的任何系統),請指定機器人訊息的可用性。

如要在 Google 管理的進入點 (包括適地性進入點非區域性進入點,Google Ads 除外) 推出代理程式,必須提供真人服務。如要指定真人服務時間,請只輸入有即時服務專員可回答問題的星期幾和時段。

如果機器人代表全天候提供服務,但真人代表的服務時間為上午 8 點至晚上 8 點,你可以分別指定這兩者。

此外,如果同時指定機器人和真人服務專員的服務時間,當機器人代表無法滿足使用者需求時,您可以傳送真人服務專員要求建議,提示使用者要求真人服務專員。

更新訊息功能適用情形

如要更新訊息服務的可用性,請使用 Business Communications API 傳送 PATCH 要求,更新代理程式的 primaryAgentInteractionadditionalAgentInteractions 欄位。

更新這些欄位時,您必須在 SupportedAgentInteraction 物件中加入所有欄位的值。更新要求會覆寫您編輯的所有欄位內容,包括任何子項欄位。舉例來說,如果您要求將執行個體新增至 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