You have the option to analyze a random subset of the conversations, a filtered subset of conversations or a combination thereof in a single request in Conversational Insights.
Prerequisites
- Make sure that the Cloud Storage, Speech-to-Text and Insights APIs are enabled on your Google Cloud project.
- Make sure that your conversation data is uploaded into Conversational Insights.
Sample Commands
Permissions required for this task
To perform this task, you must have the following permissions:
contactcenterinsights.analyses.create
Refer to the
conversations:bulkAnalyze
API endpoint for complete details. See the
Conversation
reference documentation for more information about this resource.
Before using any of the request data, make the following replacements:
- PROJECT_ID: your Google Cloud Platform project ID.
- ANALYSIS_PERCENTAGE: Percentage of the conversations to randomly analyze.
HTTP method and URL:
POST https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze
Request JSON body:
{ "analysisPercentage":ANALYSIS_PERCENTAGE }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze"
PowerShell (Windows)
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID /locations/us-central1/operations/OPERATION_ID", }
(Optional) Analyze conversations using a filter
You can view a full list of filters on the Conversation filtering page.
Before using any of the request data, make the following replacements:
- PROJECT_ID: your Google Cloud Platform project ID.
- ANALYSIS_PERCENTAGE: Percentage of the conversations to randomly analyze.
- FILTER: Filter conversations. API reference
HTTP method and URL:
POST https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze
Request JSON body:
{ "analysisPercentage":ANALYSIS_PERCENTAGE , "filter": 'FILTER '' }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze"
PowerShell (Windows)
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID /locations/us-central1/operations/OPERATION_ID", }
(Optional) Configure the analysis
Before using any of the request data, make the following replacements:
- PROJECT_ID: your Google Cloud Platform project ID.
- ANALYSIS_PERCENTAGE: Percentage of the conversations to randomly analyze.
- PHRASE_MATCHER(s): The fully qualified phrase matcher resource names of the phrase matchers you want to use for the phrase matcher annotator. If left empty, all active phrase matchers will run.
- ISSUE_MODEL(s): The fully qualified resource names of the issue models you want to use for the issue model annotator. Only works if run_issue_model_annotator is true. If left empty, all deployed issue models will run. Currently limited to 1 deployed model.
HTTP method and URL:
POST https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze
Request JSON body:
{ "analysisPercentage":ANALYSIS_PERCENTAGE "annotatorSelector": { "run_interruption_annotator": {true/false}, "run_silence_annotator": {true/false}, "run_phrase_matcher_annotator": {true/false}, "phrase_matchers":PHRASE_MATCHER(s) , "run_sentiment_annotator": {true/false}, "run_entity_annotator": {true/false}, "run_intent_annotator": {true/false}, "run_issue_model_annotator": {true/false} "issue_models":ISSUE_MODEL(s) } }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze"
PowerShell (Windows)
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/conversations:bulkAnalyze" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID /locations/us-central1/operations/OPERATION_ID", }
Poll the operation
Creating an analysis 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
Permissions required for this task
To perform this task, you must have the following permissions:
contactcenteraiplatform.operations.cancel
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:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/operations/OPERATION_ID :cancel"
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID /locations/us-central1/operations/OPERATION_ID :cancel" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{}