Automate Interactions with Contact Center AI: Challenge Lab

This article will go through the lab to Automate Interactions with Contact Center AI: Challenge Lab. In the previous, lab you will get familiar with Design Conversational Flows for your Agent, Building Virtual Agent Fulfillment, Adding a Phone Gateway to a Virtual Agent, and Dialogflow Logging and Monitoring in Operations Suite.

The challenge contains 8 required tasks.

  1. Create a Regional Cloud Storage bucket.
  2. Create a Cloud Function.
  3. Create a BigQuery dataset.
  4. Create a Pub/Sub topic.
  5. Create a Regional Cloud Storage bucket with the DFaudio folder.
  6. Deploy Dataflow pipeline.
  7. Process the sample audio files.
  8. Run a Data Loss Prevention Job.

Challenge Scenario

Your company is ready to launch a new marketing campaign. For that, they would like to know what customers have been calling customer service about and what is the sentiment around those topics. They will be sending the data to a third party for further analysis, so sensitive data such as customer’s name, phone number, address, email, SSN, should all be redacted from the data. Right now all the data that they have is available as call recordings and they have not been processed/analyzed yet.

Setting up the environment

Clone the Speech Analysis Framework source repository from the Cloud Shell

git clone https://github.com/GoogleCloudPlatform/dataflow-contact-center-speech-analysis.git

1. Create a Cloud Storage Bucket

  • In the GCP Console go to Navigation Menu >Cloud Storage>Browse.
  • Click on Create.
  • Write the name of Bucket, select Regional Cloud Storage bucket in us-central1 with a Standard storage class.
  • Click on Create.

2. Create a Cloud Function

  • In the GCP Console go to Navigation Menu > Cloud Functions.
  • Create a new function called saf-longrun-job-func.
  • Select Cloud Storage from the dropdown for the Trigger setting.
  • In the Event Type dropdown, select Finalize/Create.
  • Click on the Browse button, and choose the bucket created in Task 1.
  • Select the Runtime to be Node.js 8.
  • Open the source repository in a new window.
  • Replace the Index.js And Package.json in the Cloud Function with the source codes from the repository.
  • Write saf-longrun-job-func in the Function to execute.
Package.json
Index.js
  • Click on Environment Variables, Networking, Timeouts, and more, ensure the region is configured us-cental1 under the Advanced options.
  • Click on Create.

3.Create a BigQuery Dataset

  • In the GCP Console go to Navigation Menu >BigQuery.
  • Click on Create Database.
  • Write a Dataset ID, e.g. lab.
  • Click on Create dataset.

4.Create Cloud Pub/Sub Topic

  • In the GCP Console go to Navigation Menu>Pub/Sub > Topics.
  • Click on CreateTopic.
  • Write a Topic ID, e.g. speech2text.
  • Click on Create Topic.

5.Create a Cloud Storage Bucket for Staging Contents

  • In the GCP Console go to Navigation Menu>Cloud Storage.
  • Click on the bucket created in Task 1.
  • Create a folder called DFaudio in the bucket.

6. Deploy a Cloud Dataflow Pipeline

In the Cloud Shell, run the following commands to deploy the Dataflow pipeline.

cd dataflow-contact-center-speech-analysis/saf-longrun-job-dataflowpython -m virtualenv env -p python3
source env/bin/activate
pip install apache-beam[gcp]
pip install dateparser
export PROJECT_ID=[YOUR_PROJECT_ID]
export TOPIC_NAME=speech2text
export BUCKET_NAME=[YOUR_BUCKET_NAME]
export DATASET_NAME=lab
export TABLE_NAME=transcript
python3 saflongrunjobdataflow.py --project=$PROJECT_ID --input_topic=projects/$PROJECT_ID/topics/$TOPIC_NAME --runner=DataflowRunner --region=us-central1 --temp_location=gs://$BUCKET_NAME/tmp --output_bigquery=$DATASET_NAME.$TABLE_NAME --requirements_file="requirements.txt"

7. Upload Sample Audio Files for Processing

In the Cloud Shell, run the following commands to upload the sample audio files into your Audio Uploads Bucket.

# mono flac audio sample
gsutil -h x-goog-meta-callid:1234567 -h x-goog-meta-stereo:false -h x-goog-meta-pubsubtopicname:$TOPIC_NAME -h x-goog-meta-year:2019 -h x-goog-meta-month:11 -h x-goog-meta-day:06 -h x-goog-meta-starttime:1116 cp gs://qwiklabs-bucket-gsp311/speech_commercial_mono.flac gs://$BUCKET_NAME

# stereo wav audio sample
gsutil -h x-goog-meta-callid:1234567 -h x-goog-meta-stereo:true -h x-goog-meta-pubsubtopicname:$TOPIC_NAME -h x-goog-meta-year:2019 -h x-goog-meta-month:11 -h x-goog-meta-day:06 -h x-goog-meta-starttime:1116 cp gs://qwiklabs-bucket-gsp311/speech_commercial_stereo.wav gs://gcpmayank

8. Run a Data Loss Prevention Job

  • In the GCP Console go to Navigation Menu >BigQuery.
  • Select the table generated by the Dataflow pipeline.
  • Click on More > Query settings.
  • Write a Table name, e.g. copied
  • Click on Save.
  • Run the following SQL query.
SELECT * FROM `[YOUR_PROJECT_ID].[DATASET_NAME].[TABLE]`
  • Select the copied table
  • Click on Export > Scan with DLP.
  • In the Create job or job trigger pane, assign a Job ID
  • Click on Create.
  • Click on Confirm Create.

Congratulations! Done with the challenge lab.

Stay tuned till the next blog

If you Want to Connect with Me:

Linkedin: https://www.linkedin.com/in/mayank-chourasia-38421a134/

Twitter: https://twitter.com/ChourasiaMayank.

Google Developers Google Cloud Google News Lab Qwiklabs

I am Google Cloud Certified Associate Cloud Engineer and MS Azure Certifed. I have been working on different fields including Cloud Computing , Sap ABAP.