Showing posts with label EWT. Show all posts
Showing posts with label EWT. Show all posts

2022-01-22

Estimated Wait Time for Chat in Amazon Connect

 Some time ago I presented a method of calculating Estimated Wait Time (EWT) using Lambda function that in turn uses Amazon Connect API to get this info.

The same function can be also used to calculate EWT for chats and then you can display EWT to clients.

Step 1.

Add the same Lambda function getEWT that I mentioned in my previous article.

Step 2.

Now we can add this Lambda function to the contact flow used by chat.

1) Add Set Working Queue block

2) Add Set contact attributes block with UserDefined attribute statInterval that allows you to provide a statistical interval for which we will calculate estimated wait time.

In my case, I use 15 minutes.



3) Now invoke lambda function getEWT

4) After that we need to get the result of it by using Check contact attributes block. It will be in External attribute EWT.


5) Based on the value of EWT you can show different messages using Play prompt blocks.


Here is complete flow:





2021-09-15

Estimated Wait Time in Amazon Connect

One of the popular features of the contact center is the ability to play different comfort messages while a call is waiting in the queue.

Out of the box Amazon Connect allows you to play the following information:
  • Number of contacts waiting in the queue
  • How much time oldest contact waiting in the queue
  • Various information about how many agents are available, busy, etc...

What if you want to play Estimated Wait Time (also called Average wait time or Expected wait time in different contact center solutions)? 

It is possible to add this functionality by utilizing Amazon Connect API and Lambda function.


Step 1. 

I created AWS Lambda function getEWT. I used Python 3.9.

What it does?
1) It takes the following attributes from the call
  • statInterval - allows to define time interval that we will use to calculate Estimated Wait Time. It could be last 15 minutes or longer depending on your requirements. If statInterval attribute is missing my function will use 15 minutes as the default value.
  • channel - this parameter identifies the type of contact (Calls, Chat, Tasks) - if your Queue allows receiving different types of contacts normally you would want to have separate Estimated Wait Time for different types of contacts.
  • queueARN - this is identificator of the queue. We need to get the last 36 characters of it to get queueID- we need this parameter to be able to get real-time stats for the queue.
  • InstanceARN - ARN of your Amazon Connect instance. We need it to get InstanceId of your Amazon Connect instance which is required to use Amazon Connect API function

2) after that I connect to Amazon Connect API and use function get_metric_data to get statistical info for the queue during the required interval.

3) I get a metric called QUEUE_ANSWER_TIME - the average time that contacts wait in the queue before being answered by an agent. I use this metric as equivalent for Estimated Wait Time.


You can find the source code of this function on my Github:


Step 2.

Now you can use this Lambda function in your Customer queue flows (flow that is used when a call is waiting in queue).

1) At first you need to assign the required statistical interval to user-defined attribute statInterval using "Set contact attributes" block. 

In my example, I use 15 minutes intervals.





2) After that you can invoke getEWT function

3) It will return the external attribute EWT that contains the estimated wait time value in seconds.

Based on the returned value you can play different messages to clients or make decisions of what to do with the call.





Here is a sample call flow that I use:





Step 3.

You can also use this function in inbound contact flows or modules.

How to do it:

1) Use Set contact attributes block to define statInterval
2) Use Set working queue block to define Queue
3) Now you can use Invoke AWS Lambda function to call getEWT function
4) Use Check contact attribute to check external attribute EWT