Enabling [Cloud Pub/Sub](https://docs.cloud.google.com/pubsub) notifications lets you receive a
notification each time an Agent Assist event completes. You can
configure Agent Assist to send a notification for all events or only
specified events, including Agent Assist suggestions, conversation
lifecycle information, and live transcripts.

## Prerequisites

1. Enable the [Dialogflow API](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2-overview.md.txt).
2. Follow the instructions to [create a Cloud Pub/Sub topic](https://docs.cloud.google.com/pubsub/docs/create-topic-console).

## Enable Cloud Pub/Sub notifications

You can configure Agent Assist to send a notification for
*all events* or for *specified events* in your **conversation profile**.

A [conversation profile](https://docs.cloud.google.com/gemini-enterprise-cx/agent-assist/conversation-profile.md.txt) configures a
set of parameters that control the suggestions or notifications made to an agent
during a conversation. You have the option of configuring [Cloud Pub/Sub](https://docs.cloud.google.com/pubsub)
notifications either using the
[Agent Assist console](https://agentassist.cloud.google.com)
or by calling the API directly. You can configure each type of notification
separately, using the topics that you've created.

For more details about Cloud Pub/Sub configuration parameters, see the
[`conversationProfile` reference documentation](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles.md.txt).

### Enable Cloud Pub/Sub notifications using the Agent Assist console

> [!NOTE]
> **Note:** You can use the Agent Assist simulator to create a conversation. In this case, notifications for live transcripts and suggestions are published to Google internal Pub/Sub topics instead of the ones you configured in your conversation profiles.

When you create a new conversation profile using the
[Agent Assist console](https://agentassist.cloud.google.com),
you can select which notification types you'd like to receive using the topics
you've created:

![](https://docs.cloud.google.com/static/gemini-enterprise-cx/agent-assist/images/console-pubsub.png)

### Enable Cloud Pub/Sub notifications using the API

If you prefer to call the API directly to create or update a conversation profile,
check this section for the locations you should configure in the
[`ConversationProfile`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles.md.txt)
resource.

The following example is configured to enable all Cloud Pub/Sub notifications
that match a designated `TOPIC_ID`.

```json
{
  "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"
}
```

### Configuration of the Cloud Pub/Sub message

| Notification | Trigger | Configuration in [`ConversationProfile`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles.md.txt) |
|---|---|---|
| suggestion_event | When Agent Assist generates a suggestion | [`ConversationProfile.humanAgentAssistantConfig.notificationConfig`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles.md.txt#ConversationProfile.HumanAgentAssistantConfig.FIELDS.notification_config) Set [`SuggestionFeatureConfig.enableEventBasedSuggestion`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles.md.txt#ConversationProfile.SuggestionFeatureConfig.FIELDS.enable_event_based_suggestion) to true for selected features **Supported features: ARTICLE_SUGGESTION, FAQ AND DIALOGFLOW_ASSIST** |
| life_cycle_event | When conversation open or close | [`ConversationProfile.notificationConfig`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles.md.txt#ConversationProfile.FIELDS.notification_config) |
| new_message_event | When a new message/utterance transcript appears | [`ConversationProfile.newMessageEventNotificationConfig`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles.md.txt#ConversationProfile.FIELDS.new_message_event_notification_config) |
| new_recognition_result_event | When an intermediate transcript is available | [`ConversationProfile.newRecognitionResultNotificationConfig`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles.md.txt#ConversationProfile.FIELDS.new_recognition_result_notification_config) |

### Content of the Cloud Pub/Sub message

The content of the [Cloud Pub/Sub message](https://docs.cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1.md.txt#pubsubmessage) depends on the event that triggers that Cloud Pub/Sub notification.

| Notification | Message Data | Message Data Example |
|---|---|---|
| suggestion_event | [`HumanAgentAssistantEvent`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/HumanAgentAssistantEvent.md.txt) | { "conversation": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID", "participant": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID/participants/PARTICIPANT_ID", "suggestionResults": \[[`SuggestionResult`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/AnalyzeContentResponse.md.txt#SuggestionResult)\] } |
| life_cycle_event | [`ConversationEvent`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/ConversationEvent.md.txt) | { "conversation": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID", "type": "CONVERSATION_STARTED" } |
| new_message_event | [`ConversationEvent`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/ConversationEvent.md.txt) | { "conversation": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID", "type": "NEW_MESSAGE", "newMessagePayload": [`Message`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/Message.md.txt) } |
| new_recognition_result_event | [`ConversationEvent`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/ConversationEvent.md.txt) | { "conversation": "projects/PROJECT_ID/locations/LOCATION/conversations/CONVERSATION_ID", "type": "NEW_RECOGNITION_RESULT", "newRecognitionResultPayload": [`StreamingRecognitionResult`](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/ConversationEvent.md.txt#StreamingRecognitionResult) } |