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.
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:
For this walk through, you should have the following prerequisites:
- An AWS Account
- An Amazon Connect instance
- Familiarity with Lambda, DynamoDB, and EventBridge
These are the sequence of events that take place for the solution:
- A customer starts a chat session and this creates an Amazon Connect Contact that starts an Amazon Connect Contact Flow
- 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”
- 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
- The queue flow is looping based on the Wait Block and a play prompt block sends the position in queue message to the customer
- 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”
- The Lambda function deletes the customer record in the DynamoDB table using the ContactID from the event payload
- An EventBridge Rule invokes the Lambda function setting the operation parameter to “maintain” every minute and perform these functions
- Removes any abandoned customer records
- Update customer’s position based on the timestamp
Deployment walk through
Step 1: Get Amazon Connect Resource details
- Sign in to the AWS Management Console and navigate to the Amazon Connect console.
- Identify the Instance id of your Amazon Connect Instance and make a note of it.
- Login to your Amazon Connect Instance.
- Identify the ARN of Basic Queue in your Amazon Connect Instance.
- Navigate to Queues section in Amazon Connect Dashboard.
- Search for BasicQueue. Click on the Queue name from the search result.
- Expand the section named Show Additional Queue Information. Make a note of the ARN.
- Identify the ARN of the Sample Disconnect Flow in your Amazon Connect Instance.
- Navigate to Contact Flows from Amazon Connect Dashboard.
- Search for Sample Disconnect Flow. Click the Contact Flow from the Search result to open it.
- Click Show Additional Flow Information. Make a note of the ARN information.
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
- 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.
- Login to AWS Management Console
- Click to start deployment of this solution. Click Next.
- Enter a Stack Name (eg: ConnectChatPositionInQBlog), Amazon Connect Instance Id, BasicQueue ARN and Sample Disconnect Flow ARN from Step 1. Choose Next.
- Scroll down to the bottom of the page, Choose Next.
- 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.
- Confirm Cloudformation has completed the Stack deployment.
Step 3: Queue Configuration and Testing
- Navigate to Routing Profiles from Amazon Connect Dashboard.
- Search for Basic Routing Profile. Click on the search result to open the configuration.
- Confirm that you have BasicQueue configured as part of the Basic Routing Profile. Also Confirm that Chat is enabled for the Routing Profile.
- Open up the Test chat widget from the Amazon Connect Dashboard.
- Open up the Test Settings, point Contact Flow to PositionInQueueChat Contact Flow created from the Cloudformation Stack. Click Apply.
- You can simulate additional users by performing steps 2 and 3 in different browsers.
- 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
- Updated position of the customer is reflected when calls are answered by the agent.
- Navigate to the console, select the ConnectChatPositionInQBlog stack, and choose Delete.
- Delete the stack by choosing Delete stack on confirmation screen.
- Navigate to the console. Select Logs and then Log Groups. Delete ChatPositionInQueueLambda.
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.
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 »