Bulk delete conversations using the API

You have the option to delete a filtered subset of conversations or all the conversations in a single request in Conversational Insights. Deleted conversations cannot be recovered, so make sure you are deleting the expected number of conversations and with the correct filter.

We strongly recommend first running the command with MAX_DELETE_COUNT set to 0. Then, confirm the number of conversations that will be deleted, and run the API call with the correct MAX_DELETE_COUNT.

Prerequisites

  1. Make sure that your conversation data is uploaded into Conversational Insights.

Sample Commands

Delete all conversations

REST

Refer to the conversations:bulkDelete API endpoint for complete details.

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud Platform project ID.
  • FORCE: If true, conversations and linked analyses will be deleted, otherwise only conversations that have not been analyzed will be deleted.
  • MAX_DELETE_COUNT: Maximum number of conversations to delete. If this is lower than number of conversations in the project, API call will return an error.

HTTP method and URL:

POST https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/conversations:bulkDelete

Request JSON body:

{
  "force": FORCE,
  "maxDeleteCount": MAX_DELETE_COUNT,
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID",
}

(Optional) Delete conversations using a filter

You can view a full list of filters on the Conversation filtering page.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud Platform project ID.
  • FORCE: If true, conversations and linked analyses will be deleted, otherwise only conversations that have not been analyzed will be deleted.
  • MAX_DELETE_COUNT: Maximum number of conversations to delete. If this is lower than the number of conversations in the project, API call will return an error.
  • FILTER: See List conversations for available filter options.

HTTP method and URL:

POST https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/conversations:bulkAnalyze

Request JSON body:

{
  "force": FORCE,
  "maxDeleteCount": MAX_DELETE_COUNT,
  "filter": 'FILTER'
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID",
}

Poll the operation

Deleting conversations returns a long-running operation. Long-running methods are asynchronous, and the operation might not yet be completed when the method returns a response. You can poll the operation to check on its status. See the long-running operations page for details and code samples.

Cancel the operation

REST

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud Platform project ID.
  • OPERATION_ID: the ID of the conversation you want to analyze. This value was returned when you created the operation.

HTTP method and URL:

POST https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID:cancel

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{}