How to Analyze Conversations Using Contact Lens on Amazon Connect

Connor Blair
6 min readMay 23, 2022


Cloud computing companies, such as AWS, are continuously adding innovative ML products to their platforms. These tools can make it easy to utilize state-of-the-art machine learning models without having to develop them yourself. By utilizing Contact Lens on Amazon Connect, you are gaining access to Amazon Transcribe and Amazon Comprehend under the covers.

Contact Lens enables you to perform analytics in real time and post call. When a call is in progress, Contact Lens can alert you when a customer is getting frustrated. After a call is completed, you can view sentiment analysis on the call and extract the transcription from the conversation. In this article, we are going to walk through an example using post call analysis.


Before we begin, we are going to assume you have an AWS account and an Amazon Connect instance.

Step 0: Access Amazon Connect

Login to AWS and navigate to Amazon Connect. Click on an existing instance or create a new instance.

Navigate to “Analytics tools” and select “Enable Contact Lens”.

Go back to “Overview”. For this demo, let’s assume you are going to login using your IAM credentials — note that this method is not recommended for regular use, according to Amazon. Click on “Log in for emergency access”.

Step 1: Create the Contact Flow with Contact Lens Enabled

You need to create a new contact flow for our test. To do that, navigate to Contact Flows under Routing then click “Create contact flow”.

As a best practice, you are going to start by adding a “Set logging behavior” block.

To enable Contact Lens, you need to add a “Set Recording and analytics behavior” block to your contact flow.

Now click on the “Set recording and analytics behavior” block in the contact flow. Under Call Recording, choose “On” then “Agent and Customer” and select “Enable Contact Lens for speech analytics” under Contact Lens speech analytics.

Scroll down and select “Post-call analytics” to analyze the call recordings of the conversations after the call has ended. Under Language, manually select English. For this demo, you are not going to redact sensitive data.

To use this Contact Flow, you need to assign the caller to a queue (queues are like lines of people waiting to speak to an agent). To do that, drag a “Set Working Queue” block into the Contact Flow and connect it to “Set Recording and Analytics Behavior” block.

Click on the “Set Working Queue” block and change the queue to “BasicQueue”.

To finish the Contact Flow, you need to add a “Transfer to Queue” block and a “Disconnect” block.

Your Contact Flow is ready. To use it, you need to publish it.

Step 2: Assigning a Phone Number to the Contact Flow

To connect to your Contact Flow, you need to assign a number to it. Navigate to phone numbers under Routing.

Then click “Claim Number”.

Select Direct Inward Dialing because it is less expensive. Then select a phone number and your contact flow. Once you are ready, press save.

Step 3: Create an Agent

To answer the call, you need to create an agent. To do that, navigate to “User Management” under “Users”.

Now click “add new users”.

Once you are done entering your information, set the Security Profile to “Agent” and the Routing Profile to “Basic Routing Profile” then click save.

Step 4: Signing in as the agent

To sign in as the agent, you need to know the access URL. Navigate to the Amazon Connect console on AWS and copy the access URL.

Since you are currently signed in to Amazon Connect using your IAM credentials, you need another browser window to sign in as the agent (i.e. if you are currently using FireFox, you will sign in as the agent using Chrome.)

Once you are signed in, you should see the following screen:

Click on the phone in the top right corner to view the Contact Control Panel (CCP). The CCP is how the agent accepts the calls.

Ensure your Status is set to Available.

Step 5: Making a Test Call

Call the phone number you claimed earlier using your personal phone. Once you are in queue, Amazon Connect will try to connect the agent to your call. Click the green check mark from the CCP to answer the call.

Once you are connected, mute the agent and mute your computer speakers to reduce echo. Talk for about 20 seconds then end the call.

Step 6: Analyzing the Test Call with Contact Lens

The Contact Lens output (sentiment analysis, categories and transcript) is stored within the Contact Details in the Contact Trace Record. To view the Contact Trace Records (CTRs), click on “Contact Search” under “Metrics and Quality”.

Before you can view the results, you have to wait a few minutes for Amazon Connect to finish processing the call. Once it is ready, click on the Contact Trace Record (CTR) that matches your disconnect timestamp and your phone number. Note, if you open the contact trace record and you do not see the sentiment analysis and the transcript, just wait a little longer. The CTR is created before the sentiment analysis is ready.

Voilà! Now you can view the sentiment analysis, transcript, and categories of a call in Amazon Connect.