# Troubleshooting Dialogflow runtime integration

If you have enabled Dialogflow runtime integration but the CX Insights console doesn't display conversations that were created in Dialogflow, take the following steps to troubleshoot.

- Make sure that you have completed all of the feature [Prerequisites](https://docs.cloud.google.com/contact-center/insights/docs/enable-dialogflow-runtime-integration).
- Check whether you are using project-wide or agent-specific security settings. V2 **Security settings** apply across the whole project and are only available in the global region. All other regions will use agent-specific or conversation profile specific security settings.

- Run the following curl command to list all available security settings in your Dialogflow or Agent Assist project.

  ```bash
  curl -H "Content-Type: application/json" \
      -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
      -H "x-goog-user-project: PROJECT" \
     'https://LOCATION-dialogflow.googleapis.com/v3/projects/PROJECT/locations/LOCATION/securitySettings'
  ```
- To edit existing security settings, get the setting ID from the response of the list command. For example, `projects/ccai-fishfood/locations/us-east1/securitySettings/729a8e06dfed549f`: `SECURITY_SETTINGS=729a8e06dfed549f`.

- Run the following curl command to update your Dialogflow `SecuritySettings`. Set `enable_insights_export` to `true`.

  ```bash
  curl -H "Content-Type: application/json" \
      -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
      -H "x-goog-user-project: PROJECT" \
      -X PATCH https://LOCATION-dialogflow.googleapis.com/v3/projects/PROJECT/locations/LOCATION/securitySettings/SECURITY_SETTINGS?update_mask=insights_export_settings \
      --data '{"insights_export_settings": {"enable_insights_export": true}}'
  ```
- Use the following command to create a security setting with CX Insights enabled.

  ```bash
  curl -H "Content-Type: application/json" \
      -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
      -H "x-goog-user-project: PROJECT" \
      -X POST https://LOCATION-dialogflow.googleapis.com/v3/projects/PROJECT/locations/LOCATION/securitySettings\
      --data '{ "display_name": "Insights export enabled", "insights_export_settings": {"enable_insights_export": true}}'
  ```
- If you want to save the audio recordings for playback, run the following curl command to set the name of your Cloud Storage bucket and the format of your audio files.

  ```bash
  curl -H "Content-Type: application/json"\
      -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
      -H "x-goog-user-project: PROJECT" \
      -X PATCH https://LOCATION-dialogflow.googleapis.com/v3/projects/PROJECT/locations/LOCATION/securitySettings/SECURITY_SETTINGS?update_mask=audio_export_settings\
      --data '{"audio_export_settings":{"gcs_bucket": "BUCKET","audio_format": "FORMAT"}}'
  ```
- If using Agent Assist, attach your security settings to all your conversation profiles in the **Conversation profile** page:

- If using Dialogflow, navigate to the **Agent Settings** page and attach security settings in the **Security** tab. Repeat this step for each virtual agent.

- Make sure that some Dialogflow conversations have transpired after you enabled runtime integration. Dialogflow runtime integration does not apply retroactively to conversations.
- Make sure that the conversation is closed if using `AnalyzeContent`.
- Make sure that the Customer Experience Insights service agent has the [permissions to fetch conversations from Dialogflow](https://docs.cloud.google.com/contact-center/insights/docs/known-issues).
- Check the [Cloud Monitoring Metrics Explorer](https://cloud.google.com/monitoring/charts/metrics-explorer) to view metrics specific to the integration. Look for Resource Type **Customer Experience Insights Environment** and Metric **Notifications From Contact Center AI Runtime**. This metric shows whether Dialogflow is actually notifying CX Insights when conversations transpire.
- Check the [Logs Explorer](https://docs.cloud.google.com/logging/docs/view/logs-explorer-interface) to find where something went wrong.
- If none of the previous steps resolve your issue, reach out to your Google representative. You can send support requests and feedback directly to them.

> [!NOTE]
> **Note:** If you are filing a bug, include the results of the following curl commands in your bug.

```bash
curl -H "Content-Type: application/json"\
     -H "Authorization: Bearer $(gcloud auth application-default print-access-token)"\
     -H "x-goog-user-project: PROJECT"\
    'https://LOCATION-dialogflow.googleapis.com/v3/projects/PROJECT/locations/LOCATION/securitySettings'
```

```bash
curl -H "Content-Type: application/json"\
     -H "Authorization: Bearer $(gcloud auth application-default print-access-token)"\
     -H "x-goog-user-project: PROJECT"\
    'https://LOCATION-dialogflow.googleapis.com/v3/projects/PROJECT/locations/LOCATION/agents/AGENT-ID'
```

```bash
curl -H "Content-Type: application/json"\
     -H "Authorization: Bearer $(gcloud auth application-default print-access-token)"\
     -H "x-goog-user-project: PROJECT"\
    'https://LOCATION-dialogflow.googleapis.com/v2/projects/PROJECT/locations/LOCATION/conversationProfiles'
```