為 CCAI Agent Assist 事件啟用 Cloud Pub/Sub 通知

啟用 Cloud Pub/Sub 通知後,每當 Agent Assist 事件完成時,您都會收到通知。您可以設定 Agent Assist,讓系統在發生所有事件或僅特定事件時傳送通知,包括 Agent Assist 建議、對話生命週期資訊和即時轉錄稿。

必要條件

  1. 啟用 Dialogflow API
  2. 按照操作說明建立 Cloud Pub/Sub 主題

啟用 Cloud Pub/Sub 通知

您可以設定 Agent Assist,在對話設定檔中,針對所有事件特定事件傳送通知。

對話設定檔會設定一組參數,用來控管對話期間向服務專員提供的建議或通知。您可以選擇使用 Agent Assist 控制台或直接呼叫 API,設定 Cloud Pub/Sub 通知。您可以分別設定各類通知,並使用您建立的主題。

如要進一步瞭解 Cloud Pub/Sub 設定參數,請參閱 conversationProfile 參考說明文件

使用 Agent Assist 控制台啟用 Cloud Pub/Sub 通知

使用 Agent Assist 主控台建立新的對話設定檔時,可以選取要接收的通知類型,方法是使用您建立的主題:

使用 API 啟用 Cloud Pub/Sub 通知

如果您偏好直接呼叫 API 來建立或更新對話設定檔,請參閱本節,瞭解應在 ConversationProfile 資源中設定的位置。

以下範例已設定為啟用所有符合指定 TOPIC_ID 的 Cloud Pub/Sub 通知。

{
  "name": "projects/PROJECT_ID/locations/global/conversationProfiles/CONVERSATION_PROFILE_ID",
  "displayName": "CONVERSATION_PROFILE_NAME",
  "automatedAgentConfig": {
  },
  "humanAgentAssistantConfig": {
    "notificationConfig": {
      "topic": "projects/PROJECT_ID/topics/FEATURE_SUGGESTION_TOPIC_ID",
      "messageFormat": "JSON"
    },
    "humanAgentSuggestionConfig": {
      "featureConfigs": [{
        "enableEventBasedSuggestion": true,
        "suggestionFeature": {
          "type": "ARTICLE_SUGGESTION"
        },
        "conversationModelConfig": {
        }
      }]
    },
    "messageAnalysisConfig": {
    }
  },
  "notificationConfig": {
    "topic": "projects/PROJECT_ID/topics/CONVERSARION_LIFECYCLE_TOPIC_ID",
    "messageFormat": "JSON"
  },
  "newMessageEventNotificationConfig": {
    "topic": "projects/PROJECT_ID/topics/LIVE_TRANSCRIPT_TOPIC_ID",
    "messageFormat": "JSON"
  },
  "newRecognitionResultNotificationConfig": {
    "topic": "projects/PROJECT_ID/topics/NEW_RECOGNITION_RESULT_TOPIC_ID",
    "messageFormat": "JSON"
  },
  "languageCode": "en-US"
}

設定 Cloud Pub/Sub 訊息

通知 觸發條件 ConversationProfile 中的設定
suggestion_event Agent Assist 生成建議時 ConversationProfile.humanAgentAssistantConfig.notificationConfig
將所選功能的 SuggestionFeatureConfig.enableEventBasedSuggestion 設為 true

支援的功能:ARTICLE_SUGGESTION、FAQ 和 DIALOGFLOW_ASSIST
life_cycle_event 對話開啟或關閉時 ConversationProfile.notificationConfig
new_message_event 當系統顯示新的訊息/語音轉錄稿時 ConversationProfile.newMessageEventNotificationConfig
new_recognition_result_event 有中間轉錄稿時 ConversationProfile.newRecognitionResultNotificationConfig

Cloud Pub/Sub 訊息內容

Cloud Pub/Sub 訊息的內容取決於觸發該 Cloud Pub/Sub 通知的事件。

通知 訊息資料 訊息資料範例
suggestion_event HumanAgentAssistantEvent {
"conversation": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID",
"participant": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID/participants/PARTICIPANT_ID",
"suggestionResults": [SuggestionResult]
}
life_cycle_event ConversationEvent {
"conversation": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID",
"type": "CONVERSATION_STARTED"
}
new_message_event ConversationEvent {
"conversation": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID",
"type": "NEW_MESSAGE",
"newMessagePayload": Message
}
new_recognition_result_event ConversationEvent {
"conversation": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID",
"type": "NEW_RECOGNITION_RESULT",
"newRecognitionResultPayload": StreamingRecognitionResult
}