AWS Contact Center

Displaying position in queue for chat customers

When customers reach out for support using chat they will often need support from an agent. Setting expectations on when an agent will be available to assist helps keep customers engaged. Contact centers can inform customers about their position in queue to keep the customer informed. Using this solution, you can keep your Amazon Connect chat customers engaged and informed when interacting with your Amazon Connect based contact center.

Solution Overview

The solution builds an event driven architecture that will keep track of each contacts position in queue. The following components are used in this solution:

  1. Amazon Connect
  2. Amazon Connect Contact Flows
  3. AWS Lambda
  4. Amazon DynamoDB
  5. Amazon EventBridge Rule

Prerequisites

For this walk through, you should have the following prerequisites:

Architecture

Architecture Diagram and steps

These are the sequence of events that take place for the solution:

  1. A customer starts a chat session and this creates an Amazon Connect Contact that starts an Amazon Connect Contact Flow
  2. The Customer Queue Flow is executed when a customer is added to a queue. This flow invokes a Lambda function setting the destination key as “operation” and the value as “add”
  3. The Lambda function creates a new record in the DynamoDB table. ContactId is the Partition key because it’s unique for each chat session. Current time is also added as an attribute and is used to sort the records
  4. The queue flow is looping based on the Wait Block and a play prompt block sends the position in queue message to the customer
  5. The Customer Whisper Flow is executed when the customer is connected to an agent. This flow invokes a Lambda function setting the destination key as “operation” and the value as “delete”
  6. The Lambda function deletes the customer record in the DynamoDB table using the ContactID from the event payload
  7. An EventBridge Rule invokes the Lambda function setting the operation parameter to “maintain” every minute and perform these functions
    1. Removes any abandoned customer records
    2. Update customer’s position based on the timestamp

Deployment walk through

Step 1: Get Amazon Connect Resource details

  1. Sign in to the AWS Management Console and navigate to the Amazon Connect console.
  2. Identify the  Instance id of your Amazon Connect Instance and make a note of it.Amazon Connect Account Overview
  3. Login to your Amazon Connect Instance.
  4. Identify the ARN of Basic Queue in your Amazon Connect Instance.
    1. Navigate to Queues section in Amazon Connect Dashboard.Amazon Connect Menu - Queues
    2. Search for BasicQueue.  Click on the Queue name from the search result.Amazon Connect Queues
    3. Expand the section named Show Additional Queue Information. Make a note of the ARN.Amazon Connect Basic Queue
  5. Identify the ARN of the Sample Disconnect Flow in your Amazon Connect Instance.
    1. Navigate to Contact Flows from Amazon Connect Dashboard.Amazon Connect Menu - Contact Flows
    2. Search for Sample Disconnect Flow. Click the Contact Flow from the Search result to open it.Amazon Connect - Contact Flows - Sample Disconnect Flow
    3. Click Show Additional Flow Information. Make a note of the ARN information.Amazon Connect - Contact Flows - Sample Disconnect Flow - ARN

Step 2: Launch AWS CloudFormation template

The template creates the following resources for this solution:

  • One Lambda function – ChatPositionInQueueLambda
  • One DynamoDB table – ChatPositionInQueueDB
  • Three Amazon Connect Contact Flows
    • PositionInQueueChatFlow
    • PositionInQueueCustomerQueueAddRecordFlow
    • PositionInQueueCustomerWhisperRemoveRecordFlow
  • One EventBridge Rule – PositionInQueueEventRule
  • One IAM role that allows the Lambda function to access DynamoDB
  • One Lambda invoke permission for Amazon Connect
  • One Lambda invoke permission for EventBridge Rule

Follow these steps to deploy the template in the AWS Region where you Amazon Connect instance is deployed.

  1. Login to AWS Management Console
  2. Click to start deployment of this solution. Click Next.AWS CloudFormation - Create Stack
  3. Enter a Stack Name (eg: ConnectChatPositionInQBlog), Amazon Connect Instance Id, BasicQueue ARN and Sample Disconnect Flow ARN from Step 1. Choose Next.AWS CloudFormation - Stack Details
  4. Scroll down to the bottom of the page, Choose Next.AWS CloudFormation - Next
  5. Scroll down to the bottom of the page and acknowledge IAM resources creation, and click Submit. This will take couple minutes to provision the resources.AWS CloudFormation - IAM
  6. Confirm Cloudformation has completed the Stack deployment.

Step 3: Queue Configuration and Testing

  1. Navigate to Routing Profiles from Amazon Connect Dashboard. Amazon Connect - Menu - Routing Profiles
  2. Search for Basic Routing Profile. Click on the search result to open the configuration. Amazon Connect - Menu - Routing Profiles - Basic Routing Profile
  3. Confirm that you have BasicQueue configured as part of the Basic Routing Profile. Also Confirm that Chat is enabled for the Routing Profile. Amazon Connect - Menu - Routing Profiles - Basic Routing Profile - Config
  4. Open up the Test chat widget from the Amazon Connect Dashboard.Amazon Connect - Test Chat
  5. Open up the Test Settings, point Contact Flow to PositionInQueueChat Contact Flow created from the Cloudformation Stack. Click Apply.Amazon Connect - Test Chat - Settings
  6. You can simulate additional users by performing steps 2 and 3 in different browsers.
  7. You will now see the position of the customers coming up in their corresponding chat windows as below.
    Customer Position in a Queue 0 1 2 3
    Screenshot of Customer Chat window Test Results 0 Test Results 1 Test Results 2 Test Results 3
  8. Updated position of the customer is reflected when calls are answered by the agent.Test Results 4

Cleanup

  1. Navigate to the  console, select the ConnectChatPositionInQBlog stack, and choose Delete.AWS CloudFormation - Cleanup
  2. Delete the stack by choosing Delete stack on confirmation screen.
  3. Navigate to the console. Select Logs and then Log Groups. Delete ChatPositionInQueueLambda.Amazon CloudWatch cleanup

Call To Action

You can customize the solution for your use cases by changing prompts in the contact flow or updating the wait block with different wait times. This solution could also be used in voice deployments.

Conclusion

In this post, we implemented a solution for displaying position in queue for chat by deploying CloudFormation stack that included Lambda function, DynamoDB table, Contact Flows, IAM Roles and EventBridge Rule.

This solution also works with multiple queues where chat channel is enabled without any additional change to the solution.

For assistance with solutions for your Amazon Connect deployment you can reach out to AWS Professional Services or one of our many Amazon Connect partners.

Join us for AWS Contact Center Day, a free virtual event where you’ll learn about the future of customer service, how machine learning can optimize customer and agent experiences—and more. Register now »