AWS Contact Center

Providing great customer experiences using real-time sentiment analysis with Amazon Connect

Introduction

Contact center agents and supervisors continuously strive to provide exceptional customer service to their customers. In modern contact centers, an interactive voice response (IVR) system is typically the first point of contact for a customer seeking support. Therefore, it is crucial to provide an exceptional customer experience while the customer is interacting with the IVR. However, contact center operation teams often struggle to anticipate customer intent and take appropriate action while the customer is interacting with the IVR. This pain point can leave the customer dissatisfied and cause them to prematurely disconnect without adequately resolving their inquiry.

In this blog post, we will explore how Amazon Connect enables organizations to harness the power of AI-driven conversational analytics, enabling them to understand caller sentiment and make informed decisions in real-time. Understanding customers’ emotional tone during voice calls or chat interactions is valuable for improving customer service experiences. For instance, by detecting positive sentiment, you can seize opportunities to upsell or cross-sell additional services, capitalizing on the customer’s receptive mindset. Conversely, if negative sentiment is detected, you can promptly escalate the interaction to an agent or supervisor, ensuring that any concerns are addressed swiftly and effectively. We will also walk you through how Amazon Q in Connect uses generative artificial intelligence (AI) to deliver agents suggested responses and actions to address customer questions, providing faster issue resolution and improved customer satisfaction.

Solution overview

Figure 1: Real-time sentiment analysis architecture

The architecture (figure 1) of the solution is shown above. The architecture is comprised of services that are available within Amazon Connect, or you can quickly integrate them using a visual interface with no coding required.

As shown in the architecture diagram (figure 1) callers using chat are:

  1. First connected to Amazon Connect.
  2. Amazon Connect uses an Amazon Lex chatbot (as defined in the flows) to interact with the caller.
  3. Amazon Lex uses the built-in integration with Amazon Comprehend to determine the sentiment of the caller and returns the sentiment back to Amazon Connect.
  4. Based on the returned sentiment and defined business rules, Amazon Connect determines how to provide the best customer experience by escalating to an agent.
  5. Amazon Q in Connect provides agent assistance by searching the knowledge base for an appropriate response and resolution to send back to the customer.

In steps A and B (described later in this post), you upload a Word document to Amazon S3 and Amazon Q in Connect indexes the document to create a knowledge base to provide agent guidance.

Walkthrough

Amazon Connect, with its integration to Amazon Lex and Amazon Comprehend uses machine learning (ML) to analyze a caller’s sentiment during a caller interaction. Amazon Comprehend returns an overall sentiment of positive, mixed, neutral, or negative sentiment types and for each, associates a corresponding sentiment score between 0 and 1. The 0 through 1 represent score represents how confident the Amazon Comprehend ML model is of the caller’s sentiment during the interaction. You can use your company’s business policies and domain knowledge to craft journeys for different customer scenarios based on the overall sentiment and sentiment scores.

In this blog, we will demonstrate two scenarios where a customer uses the chat service of a fictitious car rental company to voice displeasure to poor service. The overall sentiment returned by Amazon Comprehend in both cases is negative.

In the first scenario, the customer is very upset, and therefore the sentiment score returned by Amazon Comprehend is closer to 1, and the company’s business policy dictates that the caller must be immediately escalated to a live chat agent. In this scenario, Amazon Q in Connect also provides guidance to the agent on how to properly respond. In the second scenario, the caller’s sentiment score is closer to 0.7, and the company’s business rules dictate that the caller be offered a discount due to the inconvenience caused.

The solution is deployed using the AWS CloudFormation template. The template creates Amazon Connect flows on an existing Amazon Connect instance and configures Amazon Lex bots for the chat interactions.

In this blog post, you follow the below steps:

  1. Create a new Amazon Connect instance if you do not have an existing instance.
  2. Enable Amazon Q in Connect for your Amazon Connect instance with a S3 bucket as the repository for the knowledge base article for agent guidance.
  3. Deploy the AWS CloudFormation template to deploy the Amazon Connect flow and Amazon Lex bots.
  4. Test the solution using the provided test chat utility, Amazon Connect Agent Workspace, Amazon Lex chatbot, and live chat with an agent.
  5. Observe the caller and agent experience via the Amazon Connect Agent Workspace.
  6. Clean up the installation.

Prerequisites

For this walkthrough, it is assumed that you have a basic knowledge of Amazon Connect, and access to the following resources:

  1. An AWS account with user permissions to run the AWS CloudFormation
  2. An existing Amazon Connect instance.
  3. Familiarity with the AWS Console.
  4. Familiarity with Amazon Connect.

Deploying the solution

Deploy the CloudFormation template.

For deploying the solution, you will need the follow the steps below.

  • Amazon Connect instance ID/ARN
  • To get the ARN, log in to the AWS Management Console and then click on the Amazon Connect service.
  • Click the instance alias of your Amazon Connect instance to get to the overview page shown below (figure 2). Click the icon on the left of the ARN to copy it.

Figure 2: Instance alias of an Amazon Connect instance

  • Click on to create a CloudFormation stack in the Region of your choice. This launches the AWS CloudFormation stack to create the resources in your account so you can test the scenarios in the next section. Ensure your Amazon Connect instance is in the same Region.
  • Enter the stack name of your choice and then, in the parameters section of the AWS CloudFormation template, paste your connect instance ARN of the Amazon Connect instance you copied earlier and click Next. Refer to screenshot (figure 3) below.

Figure 3: Entering stack details in AWS CloudFormation template

  • Accept all the defaults on this screen and then click Next.
  • On the bottom of this screen Check the box for “I acknowledge that AWS CloudFormation might create IAM resources.”
  • Choose Create Stack.
  • The AWS CloudFormation template may take 15-30 minutes to create all the resources. Once done, it will show the status as “CREATE_COMPLETE”.
  • Next you need to setup the Amazon Q in Connect knowledge base and for that you need to upload a Word document to Amazon S3. Amazon Q in Connect uses the content of the Word document to provide agent guidance in real-time based on voice or chat conversations between the customer and the agent.
    • On the output tab of AWS CloudFormation (figure 4) user interface copy the Amazon S3 bucket URL value (only the text after the “arn:aws:s3:::” prefix) that was created by the AWS CloudFormation template.

Figure 4: S3 bucket URL

    • In the AWS console click on Amazon S3 service and then search for the bucket you copied on the previous step.
    • Download this Word document to your local drive then upload the document to the Amazon S3 bucket.

 

Test the solution using chat

For testing the chat interactions, you will be acting as a customer of fictitious AnyCompany Car Rentals to help you resolve your complaints in a timely manner. Some complaints you may have are that you were overcharged for your last car rental, that you were overcharged for gas even though you returned the car with a full tank, or that you encountered poor customer service at the rental counter. Depending on the level of your negative sentiment, AnyCompany Car Rentals can use sentiment scores to determine the next best action to take to ensure that you are satisfied with the outcome of your interaction.

Now, test the solution where you can log in as the agent and initiate an interaction with AnyCompany Car Rentals as a customer.

Make sure you have completed the steps as explained above and you have signed in to the Amazon Connect administrator website.

You will initiate the chat interaction by clicking on the Test Chat link (figure 5) as follows:

  • Click on the dashboard icon from the admin UI and then click Test Chat

Figure 5: Admin UI dashboard and test chat links

  •  Click on test settings (figure 6) on the dashboard screen

Figure 6: Test settings link

  • Make sure the settings are as below (figure 7) after you click on the Test Settings link and then click Apply.

Figure 7: Test settings configuration

  • Open the Agent Workspace (figure 8) as shown below and when the window opens make sure you have set yourself from offline to available using the dropdown (figure 9). Note: Allow any popups asking for permissions.

Figure 8: Agent workspace link

Figure 9: Agent status dropdown

  • On the Amazon Connect administrator website click on start testing chat (figure 10) as shown below.

Figure 10: Start test chat link

  • Follow the two scenarios below to test the user experience based on sentiment scores. Accept the incoming chat (figure 11) on the Agent Workspace when receiving the chat request. Note: The agent workspace is on a popup window.

Figure 11: Test chat widget with incoming chat request

You can now use the following sample scripts to generate a chat conversation and then observe the caller and the agent experience for the two different customer experience scenarios.

Scenario 1: In this scenario, you are not satisfied with your last car rental since you were overcharged for gas even though you returned it with a full tank of gas. Since this is a billing issue, the AnyCompany Car Rental’s policy dictates that the next-best action based on the negative sentiment score of greater than 0.70 transfers you to a live chat agent to help you further. The business logic for the transfer to a live chat agent is implemented via Amazon Connect flows.

Chatbot: Welcome to AnyCompany Car Rentals. How can I help you today?

User: I need to talk to an agent.

Chatbot: Sure, I can help you with that. To verify you can I have your first name?

User: <provide your first name>

Chatbot: Can I have your last name?

User: <provide your last name>

Chatbot: Can you provide your account number?

User: 123456

Chatbot: Thanks. Can you provide us with some more information about your inquiry?

User: I was overcharged for my rental

Chatbot: Hello <FirstName> <LastName>, we are transferring you to a live agent now.

Live chat agent: Hello <FirstName> <LastName>, sorry to hear that you are not satisfied with our service.

User: Yes, correct I was overcharged for my last rental.

Note: Notice how agents can view guidance in their agent workspace with information provided by Amazon Q in Connect on the suggested solution and response. Besides the generative AI-powered information and response suggested by Amazon Q in Connect, you can also use the search bar to search for information in the knowledge base. You can open the referenced document to get more detailed guidance on how to responded to the customer.

Live chat agent: <Provide response to customer as per guidance from Amazon Q in Connect.>

Live chat agent: Is there anything else I can help you with?

User: No, thanks for your help.

Scenario 2: In this scenario, your overall satisfaction with AnyCompany Car Rentals is poor due to the long lines at the rental counter you encountered. Based on company policy, the next-best action for a sentiment score less than 70% is that AnyCompany Car Rentals will offer you a discount on your next renter. This logic is defined in Amazon Connect flows.

Chatbot: Welcome to AnyCompany Car Rentals. How can I help you today?

User: I need to talk to an agent.

Chatbot: Sure, I can help you with that. To verify you can I have your first name?

User: <provide your first name>

Chatbot: Can I have your last name?

User: <provide your last name>

Chatbot: Can you provide your account number?

User: 123456

Chatbot: Thanks. Can you provide us with some more information about your inquiry?

User: There were long lines at the rental counter

Chatbot: We apologize for your inconvenience. Since you are a loyal customer, we have applied a 25% discount on your next car rental. Thank you for being a loyal customer and please do not hesitate to contact us if this resolution does not meet with your expectations.

At this point you can try other scenarios or proceed to the next section to clean up the installation so you do not incur additional charges.

Cleanup

To avoid incurring future charges, delete the resources that were created. The Amazon S3 bucket created as part of the CloudFormation stack will not be deleted upon deletion of stack. Please manually delete it by deleting the knowledge base Word document first and then delete the Amazon S3 bucket.

Please see the following links for further guidance:

  1. Delete AWS CloudFormation stack
  2. Delete Amazon Connect instance
  3. Delete Amazon S3 bucket

Conclusion

In this post, you have learned how to use Amazon Connect, Amazon Lex, and its built-in integration with Amazon Comprehend sentiment analysis to provide a great customer experience in real-time. You also used Amazon Q in Connect to provide generative AI-powered agent assistance on how to respond to customers in real-time.

As next steps, you can learn more about Amazon Connect in the Administrator Guide here, about Amazon Comprehend in AWS Documentation, and watch a demo of Amazon Q in Connect. You can also sign up for an AWS Skill Builder account, where you can find free digital courses on Amazon Connect, Amazon Comprehend and other AWS services.

About the authors

Joydeep Dutta is a Principal Solutions Architect at AWS. Joydeep enjoys working with AWS customers to migrate their workloads to the cloud, optimize for cost and help with architectural best practices. He is passionate about enterprise architecture to help reduce cost and complexity in the enterprise. He lives in New Jersey and enjoys listening to music and enjoying the outdoors in his spare time.

 

Utsav Joshi is a Principal Technical Account Manager at AWS. He lives in New Jersey and enjoys working with AWS customers in solving architectural, operational, and cost optimization challenges. In his spare time, he enjoys traveling, road trips, and playing with his kids.