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)?
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
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.
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
first of all thanks for sharing it, you are doing such amazing job.i have tried to setup the same lambada function but i am getting an error "TypeError: 'NoneType' object is not subscriptable Traceback (most recent call last)" Any idea?
ReplyDeleteWhere do you get this error?
DeleteWhat if I just want to tell position of customer in queue.
ReplyDeletenot currently supported by Amazon Connect
Deleteis it even not possible by lambda function? Like You are 3 in queue or 2 in the queue. Your feedback so valuable for me.
Deletenot even with Lambda
Deleteyou can use a lambda, with the following, 1. method = put. as the customer enters the queue, trigger the lambda to enter the contactId and timestamp into DynamoDB. 2. method = get. query the DynamoDB for all entries that contain the matching queue. 3. remove from queue. once the caller is picked up by agent ( use agent whisper flow ) to remove the agent from the DynamoDB.
DeleteYou will also want some form of TTL on there as the downside is that if a user abandons the call after the put and before the delete. you will have orphaned entries. the TTL will help keep that cleaned up. this works well and keeps a fairly accurate solution
It could work. Additional limitation is that assumption here that each call has the same priority.
DeleteI am getting the "errortype":"key error" and the "errormessage":"Details" . What will be the code for configuration of test event???
ReplyDeletePlease provide all the required parameters in test event.
Delete{
"Details": {
"ContactData": {
"Attributes": {
"statInterval": "15"
},
"Channel": "VOICE",
"ContactId": "FFFFFFF-6a92-4db1-9096-5f457e1cd35a",
"CustomerEndpoint": {
"Address": "",
"Type": "TELEPHONE_NUMBER"
},
"CustomerId": null,
"Description": null,
"InitialContactId": "FFFFFFF-6a92-4db1-9096-5f457e1cd35a",
"InitiationMethod": "INBOUND",
"InstanceARN": "arn:aws:connect:us-east-1:GGGGGGGGG:instance/RERERERERERR-4103-4824-DFDSFSS-FSAFSSDAAF",
"LanguageCode": "en-GB",
"MediaStreams": {
"Customer": {
"Audio": null
}
},
"Name": null,
"PreviousContactId": "SDFASFASFAS-6a92-4db1-9096-ASFDASFAS",
"Queue": {
"ARN": "arn:aws:connect:us-east-1:FFFFFFFFFFF:instance/SAFASDFAFD-4103-4824-aea2-AFADFAFSAF/queue/ASFAFSDASFA-b99a-4697-b021-982aa71a37fd"
},
"References": {},
"RelatedContactId": null,
"SystemEndpoint": {
"Address": "",
"Type": "TELEPHONE_NUMBER"
}
},
"Name": "ContactFlowEvent"
}