AWS Feed
Setting up an IVR to collect customer feedback via phone using Amazon Connect and AWS AI Services
As many companies place their focus on customer centricity, customer feedback becomes a top priority. However, as new laws are formed, for instance GDPR in Europe, collecting feedback from customers can become increasingly difficult. One means of collecting this feedback is via phone. When a customer calls an agency or call center, feedback may be obtained by forwarding them to an Interactive Voice Response (IVR) system that records their review star rating with open text feedback. If the customer is willing to stay on the line for this, valuable feedback is captured automatically, quickly, and conveniently while complying with modern regulations.
In this post, we share a solution that can be implemented very quickly and leverages AWS artificial intelligence (AI) services, such as Amazon Transcribe or Amazon Comprehend, to further analyze spoken customer feedback. These services provide insights to the sentiment and key phrases used by the caller, redact PII and automate call analysis. Amazon Comprehend extracts the sentiment and key phrases from the open feedback quickly and automatically. It also ensures that PII is redacted before data is stored.
Solution overview
We guide you through the following steps, all of which may be done in only a few minutes:
- Upload the content to an Amazon Simple Storage Service (Amazon S3) bucket in your account.
- Run an AWS CloudFormation template.
- Set up your Amazon Connect contact center.
- Generate a phone number.
- Attach a contact flow to this number.
- Publish your first IVR phone feedback system.
The following diagram shows the serverless architecture that you build.
This post makes use of the following services:
- Amazon Connect is your contact center in the cloud. It allows you to set up contact centers and contact flows. We use a template that you can upload that helps you create your first contact flow easily.
- Amazon Kinesis Video Streams records the spoken feedback of your customers.
- Amazon Simple Queue Service (Amazon SQS) queues the video streams and triggers an AWS Lambda function that extracts the audio stream from the video stream.
- Amazon Transcribe translates the spoken feedback into written text.
- Amazon Comprehend extracts the sentiment and key phrases from the open feedback quickly and automatically.
- Amazon DynamoDB is the NoSQL data storage for your feedback.
- Amazon S3 stores the WAV files generated by Amazon Transcribe and the JSON files generated by Amazon Comprehend.
- Lambda extracts audio streams from video streams, loads feedback data to DynamoDB, and orchestrates usage of the AI services. One of AWS Lambda functions is a modification of the following code on GitHub.
Download Github repository
As a first step, download the GitHub repository for this post. It contains the following folder structure:
- cloudformation – Contains the CloudFormation template
- contactflow – The 30 seconds of silence WAV file and the Amazon Connect contact flow
- src – The source code of the Lambda functions
You also have a file named build.sh
. We use this file to deploy all the resources in your account. You need the AWS Command Line Interface (AWS CLI) and Gradle to compile, upload, and deploy your resources.
Running the build script
Before we can run the build, we need to open the build.sh
file and set a Region, S3 bucket name, and other information. The script performs the following steps for you:
- Creates a S3 bucket that hosts your CloudFormation template and Lambda source code
- Builds the Gradle project (a Java-based Lambda function) to extract voice from a video stream (see also the following GitHub repository)
- Zip all Lambda functions from the
src
folder - Upload the CloudFormation template and the zipped Lambda functions
- Create a CloudFormation stack
The top of this script looks like the following screenshot.
Provide your preferred setup parameters and make sure you comply with the allowed pattern. You fill out the following fields:
- ApplicationRegion – The Region in which your IVR is deployed.
- S3SourceBucket – The name of the S3 bucket that is created during the build phase. Your CloudFormation template and Lambda code resources are uploaded to this bucket as part of this script.
- S3RecordingsBucketName – This is where the open feedback field (WAV recordings) are stored in your IVR feedback channel.
- S3TranscriptionBucketName – After the WAV files are transcribed, the JSON output is saved here and a Lambda function—as part of your CloudFormation stack—is triggered.
- DynamoDBTableName – The name of your DynamoDB table where the feedback data is stored.
- SQSQueueName – The SQS queue that orchestrates the extraction of the customer open feedback.
- CloudFormationStack– The name of the CloudFormation stack that is created to deploy all the resources.
After you fill in the variables with the proper values, you can run the script. Open your bash terminal on your laptop or computer and navigate to the downloaded folder. Then run the following code:
After performing this step, all the necessary resources are deployed and you’re ready to set up your Amazon Connect instance.
Creating an Amazon Connect instance
In our next step, we create an Amazon Connect instance.
- First, we need to give it a name.
You can also link the Amazon Connect instance to an existing account or use SAML for authentication. We named our application ivr-phone-feedback-system
. This name appears in the login as Amazon Connect and is not managed from within the AWS Management Console.
- For the rest of the setup, you can leave the default values, but don’t forget to create an administrator login.
- After the instance is created (it takes just a few moments), go back to the Amazon Connect console.
- Choose your instance alias and choose Data Storage.
- Choose Enable live media streaming.
- For Prefix, enter a prefix.
- For Encryption, select Select KMS key by name.
- For KMS master key, choose aws/kinesisvideo.
- Choose Save.
- In the navigation pane, choose Contact Flows.
- In the AWS Lambda section, add two of the functions created by the CloudFormation stack.
Setting up the contact flow
In this section, we use the files from the contactflow
folder, also downloaded from the Knowledge Mine repository in our very first step.
- In the Amazon Connect contact center, on the Routing menu, choose Prompts.
- Choose Create new prompt.
- Upload the
30_seconds_silence.wav
file.
You also use this for the open feedback section that your customers can interact with to provide verbal feedback.
- On the Routing menu, choose Contact flows.
- Choose Create contact flow.
- On the drop-down menu, choose Import flow.
- Upload the contact flow from the
contactflow
folder (ivr-feedback-flow.json
, included in the Knowledge Mine repo).
After you import the contact flow, you have the architecture as shown in the following screenshot.
For more information about this functionality, see Amazon Connect resources.
To make this contact flow work with your account, you only need to set the Lambda functions that are invoked. You can ignore the warning icons when adding them; they disappear after you save your settings.
- Choose your respective contact flow box.
- In the pop-up window, for Function ARN, select Select a function.
- For box 1, choose IVR-AddRating2DynamoDB.
- For box 2, choose IVR-SendStream2SQS.
- Choose Save.
- Choose Publish.
Your contact flow is now ready to use.
Creating your phone number
Your IVR phone feedback system is now ready. You only need to claim a phone number and associate your contact flow with that number before you’re done.
- On the Routing menu, choose Phone Numbers.
- Choose Claim a number.
- Select a number to associate.
- For Contact flow/IVR, choose your contact flow.
- Choose Save.
Congratulations! You can now call the number you claimed and test your system. Results end up in the DynamoDB table that you created earlier.
Every time open feedback is provided, it’s stored in DynamoDB and analyzed by our AWS AI services. You can extend this system to ask for more ratings as well (such as service dimensions). You can also encrypt customer feedback. For more information, see Creating a secure IVR solution with Amazon Connect.
Conclusion
Gathering customer feedback is an important step in improving the customer experience, but can be difficult to implement in a rapidly changing legal landscape.
In this post, we described how to not only collect feedback but process it, with the customer’s consent, via automation on the AWS platform. We used a CloudFormation template to generate all the serverless backend services necessary, created an Amazon Connect instance, and created a contact flow therein that was associated with a phone number.
With this setup, we’re ready to collect critical customer feedback ratings and identify areas for improvement. This solution is meant to serve as only a basic example; we encourage you to customize your contact flow to best serve your business needs. For more information, see Create Amazon Connect contact flows.
The AI services used in this post have countless applications. For more information, see AI Services.
About the Authors
Michael Wallner is a Global Data Scientist with AWS Professional Services and is passionate about enabling customers on their AI/ML journey in the cloud to become AWSome. Besides having a deep interest in Amazon Connect he likes sports and enjoys cooking.
Chris Boomhower is a Machine Learning Engineer for AWS Professional Services. He loves helping enterprise customers around the world develop and automate impactful AI/ML solutions to their most challenging business problems. When he’s not tackling customers’ problems head-on, you’ll likely find him tending to his hobby farm with his family or barbecuing something delicious.