2022-04-12

Tasks as alternative to Callback in Amazon Connect

Amazon Connect has a built-in ability to add Callback option in IVR.
But unfortunately, it lacks some features that might be required for some users such as:
* Once callback is sent to queue - it cannot be removed. It will stay in the queue for 7 days until answered by agent or will be deleted by the system after 14 days
UPDATE (2022-04-23): You can now do it using  Amazon Connect API - StopContact action.
* Not possible to show additional information about callback if you use out of the box CCP
(can be added in Custom CCP)
* Not possible to schedule callback at a later time  (out of the box)

A not long time ago Amazon Connect introduced Tasks as an additional channel in contact center.
It is possible to add Callback using Tasks. 


How does it work:

1. First we will ask client to enter callback number
2. Instead of using block to send call to callback queue we can add Create task block
3. We will add callback number as one of the attributes in Create task block
4. We can use built-in features of Create task block to either send it to queue right away or schedule it for later.  Scheduled time can be based on selection made by client.
5. We can also add additional attributes to Create task block. In my example, I ask client to enter an account number and then I will add this attribute so that agent would be able to see this information.
6. When Callback comes to an agent they would see the following information:


7. Agent can click on phone number and it will initiate an outbound call to client.

*******



Here is more detailed comparison of standard callback vs Callback using Tasks:


Functionality Standard
Callback
Task
Manually remove callback from queue UPDATE (2022-04-23): 
Yes, can be removed from the queue using Amazon Connect API (StopContact action)
Yes, can be removed from the queue using Amazon Connect API (StopContact action)

Outbound call initiation
Automatic.

Outbound call automatically starts when an agent answers callback.
Manual.

An agent has to click on the phone number to initiate an outbound call.
Possibility to show additional attributes in CCP. Not possible directly in CCP. Can be added in custom CCP. Yes. Possible out of the box.
Ability to schedule callback at a later time Not possible out of the box. Yes. Possible out of the box.

Multiple retries
Yes, it is possible to specify the number of retries and time between attempts. Not possible out of the box.
An agent can manually schedule the next attempt by creating a task in CCP interface. 
Different priority for callback Only possible if you use a separate queue for callbacks. Yes. It is possible since Task is a separate channel.
Different SLA for callback Only possible if you use a separate queue for callbacks. Yes. It is possible since Task is a separate channel.




Here is an example of contact flow that uses Tasks to enable Callback option.

1) First I ask client to enter account number and store it to attribute account_number
2) After that I ask client to enter phone number (10 digits) and save it to attribute callback_number
3) After that I create task and add callback_number & account_number as attributes.














2022-04-09

Amazon Connect new features

 Amazon Connect having a blast this April.

They released multiple nice features. Some of them are really desired by many clients.

Full list is here:

https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-release-notes.html#april22-release-notes

What's new:

  • Play prompts from an Amazon S3 bucket
You can finally specify a path to prompt file. No need to create prompts and load them into Amazon Connect. That makes it easier to manage prompts. 
I have several articles about ability to disable/enable certain prompts in the IVR (Emergency Messages).
With this new functionality of Amazon Connect I can make it more flexible and use prompts directly from S3 bucket.

  • CloudTrail support for queues and routing profiles
Now Amazon Connect allows to track all the changes made for users, queues and routing profiles. System allows to track who did the change, when, and what was changed. Super important to keep track of all the changes in contact center.

  • Multi-party calls
Agent can now have multi-party call for up to 6 participants (before it was only up to 3 participants).

2022-02-20

Configure internal extension for IVR in Genesys Cloud

Imagine that you need to setup an internal extension that will point to IVR flow.

The official documentation is not clear on this topic and it may seem that this is not supported.

I found a method that allows me to achieve it.

***

Let's say that in your dialplan you want to have a range of internal extensions that will be used to send calls to different IVR flows.

For example: 6XXX.


Step 1.

Go to configuration of the Site where your user phones are.

Click Edit Site and open Number Plans page


Step 2.

Add a new Number Plan and configure it this way:

  • Number Plan Name:  Internal  (or name it the way you like)
  • Match Type: Regular Expression
  • Match Expression: ^(6\d{3})$
  • Normalized Number Expression: sip:$1@localhost
  • Classification: Internal (or use default one Extension)
      • to create a new classification - just type new name instead of selecting existing


Regular expression ^(6\d{3})$ - means a number that starts with 6 and has 3 digits after, so exactly what we need 6XXX.

Move it in the list so that it is somewhere at the top, let's say after Emergency but before Extension.


Step 3.

Now we will add new call route:

Example:

  • Name: 6001 - this is your internal extension
  • Regular routing - All Calls  --  TestFlow01   (name of your IVR flow)  



You can add additional routes the same way (for example 6002, 6003, etc...)



Step 4.

The last step - let's test it.

In dialpad enter 6001. You should hear your IVR flow.



*********

You might ask - how does it work?

Well, maybe it is documented somewhere (but I did not find it). But I found out that Genesys Cloud allows you to dial the following entities by name:

  • Call Flow
  • Call Route
  • Queue

You can test it yourself.

In dialpad enter the name of your call flow or enter the name of any call route. Even if it contains characters Genesys Cloud will allow you to dial it. 



2022-02-17

Exporting data from Interaction Administrator (Genesys PureConnect)

 Sometimes you need to export configuration data from Genesys PureConnect.

There are multiple ways to do that. Here are some of them:

1) use DSEditU utility (or directly use Regedit) on CIC server.

Most of the configuration items are stored in Windows Registry and can be viewed/exported using DSEditU.

After you export it you can parse it using scripts.

2) Using custom handlers.

There are several system tools available in Interaction Designer that allows you to export data

https://help.genesys.com/pureconnect/mergedProjects/wh_id/desktop/hid_system.htm

  • Get DS Attr
  • Get DS Attrs
  • Get DS Keys
  • Get DS Parameter
Directory Services (DS) is exactly the same Windows Registry where PureConnect CIC server keeps most of the configuration.

3) Use ICWS or ICE Lib API
https://help.genesys.com/developer/cic/docs/icws/webhelp/conceptualcontent/welcome.htm
https://help.genesys.com/developer/cic/docs/icelib/webhelp/index.html

Limitation: Both ICWS and ICE Lib API do not allow you to export Stations/Managed IP Phones information.

4) Custom tools/custom scripts

In the past, I created an article about 2 tools that were created by Genesys employees.
Both are using ICWS API and can help you with data export/bulk updates etc...
  • https://github.com/GenesysPureConnect/cli - Command line tool that allows interacting with CIC
  • https://github.com/gildas/posh-ic - Collection of PowerShell scripts to interact with CIC
Limitation: Both ICWS and ICE Lib API do not allow you to export Stations/Managed IP Phones information.

5) IA_Export script 

I developed my own PowerShell script that allows to export data from Interaction Administrator.
It uses WinAPI to grab data from SysListViews of Interaction Administrator.

You can download it from my GitHub:


How to use it:
1. Download PowerShell script IA_Export.ps1
2. Download ManagedWinapi.dll from http://mwinapi.sourceforge.net/
3. Place ManagedWinapi.dll and the script in the same directory
4. Open PowerShell (x86)
5. Open Interaction Administrator and select one of the views that you want to export.
For example "Managed IP Phones"
6. Run the script 
.\IA_Export.ps1 "Managed IP Phones"
7. It will start exporting data to CSV file in the same directory where your PowerShell script is located.



  • This script exports data exactly as you see it in Interaction Administrator. For example, if you applied a filter or sorted it - it will export only data that you see, exactly as you see it.
  • Make sure that you run it in PowerShell (x86)
  • Make sure that your Interaction Administrator is open and you selected the view that you want to export. Otherwise, it will not work.
  • Full list of commands that you can use:
      • .\IA_Export.ps1 "Managed IP Phones"
      • .\IA_Export.ps1 "Stations"
      • .\IA_Export.ps1 "Users"
      • .\IA_Export.ps1 "Structured Parameters"
      • .\IA_Export.ps1 "Roles"
      • .\IA_Export.ps1 "Workgroups"
      • .\IA_Export.ps1 "Schedules"
      • .\IA_Export.ps1 "Queue Columns"
      • .\IA_Export.ps1 "Client Buttons"
      • .\IA_Export.ps1 "Tables"
      • .\IA_Export.ps1 "Status Messages"
      • .\IA_Export.ps1 "Web Services Parameters"
      • .\IA_Export.ps1 "Licenses Allocation"





 

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:





2022-01-10

Troubleshooting flows in Amazon Connect

 I would like to share several methods that I use to troubleshoot contact flows in Amazon Connect.


1) Enable Amazon CloudWatch Logs

Official Amazon Connect documentation explains how to enable CloudWatch logs for Amazon Connect.

https://docs.aws.amazon.com/connect/latest/adminguide/contact-flow-logs.html

IMPORTANT - By default logs will not be collected. You have to manually enable logs for each contact flow or module.


2) Contact search

https://docs.aws.amazon.com/connect/latest/adminguide/contact-search.html

Contact search is the built-in interface of Amazon Connect that allows searching for contacts.
Contact search only shows contacts that were answered by an agent.
Contacts appear in the contact search several minutes after the call was disconnected.

What could be helpful for troubleshooting - when you use Set contact attributes block in your flow - this information will be also available in the Contact search. 

Example:


And in Contact search:





3) Lambda Logger function 

Another method that I use for troubleshooting is a very simple custom made Lambda function - logger (written in Python 3.9)


Source code on my GitHub:


It is very simple:

1) You add Invoke AWS Lambda function block anywhere in your contact flow.  This block will execute logger function.

You can place this block as many times as you need in all the places of your flow that you want to troubleshoot/debug.

2) Optionally you can add any number of input parameters that you would like to be added to the log for debugging.

Example:


3) Then you make a test call.

4) Now you can go to CloudWatch  and see logs generated by this function:



5) As you can see in my example in the log you can see all the contact details including the input parameter that you entered previously.



This function can be helpful when you want to see all the contact details at a certain place of your contact flow.


2022-01-05

Check Queue is out of service in Amazon Connect

I want to talk about one issue with Amazon Connect. This is something that in my opinion Amazon should be fixing ASAP.

Scenario 1
1. Agent opened Amazon Connect Contact Control Panel (CCP) and changed their status to Available.
2. Agent closed CCP without changing status to Offline
3. Agent is still considered as Available so if you check the number of Staffed or Online agents for the queue this agent is still counted.
4. Agent would stay Available  until 
  • they are logged back in 
  • Supervisor manually changed their status
5. Since they are Available system might send a contact to them and after 20 seconds their status will change to Missed.


Scenario 2
1. Agent logged in to CCP and changed their status to Available
2. Agent fell asleep / went out to buy milk / ... and forgot to close CCP
3. Agent is still considered as Available so they would receive a call and after 20 seconds if it was not answered agent will be marked as Missed.
4. But again agent will be counted in the number of Staffed or Online agents forever.


It is very surprising that Amazon Connect does not have some sort of timeout value like in other contact center solutions. The system should be able to detect that agent left and change their status to logged out automatically after some time. It is not wise to always rely on agents to do the right thing.
What if it is the night shift and you have a very small amount of agents (maybe 1-2 agents) without any supervision?


Another issue that is directly related to the previous one - if in your flow you want to check if Queue is out of service (meaning that you have 0 agents logged in that could answer calls for the specific queue) - you cannot use the number of Staffed or Online agents to make this decision. You also cannot use Available agents, since Available agents show agents that are available right now to take calls, but if an agent is on the call, he is no longer available for the duration of the call but that does not mean that you should be excluding this agent from the total count of agents that are available to take calls during the shift.

Ok. Now what we can do about it?

1. Custom CCP application 
  
Create a custom CCP application that will automatically change agent status to Offline when they close CCP.
  • It requires custom development
  • Still, not a bulletproof solution as agents might simply close the browser or shut down their PC (or some technical problem)
  • The situation with missed calls is still not resolved
You can find a detailed solution in the official Amazon Connect documentation:

This would bring additional relief but still, you have to rely on agents to do the right thing. 

2. Custom formula to check if Queue is OOS

 Instead of using the number of Staffed agents use the following formula:

Potentially Available agents in Queue = Staffed agents - Agents in Error state
So, if this number is equal to 0  = Queue is Out of service.

An agent is considered to be in an Error state if they missed the call. So as you can see this formula covers both scenarios. 

Now, the question is how to add this formula to contact flows.
In order to do that we need to use Lambda function.

I created a sample Lambda function that is called checkQueue (using Python 3.9)

How it works:
1) In the contact flow you need to use Set working queue block as you would normally do before transferring call to queue.
2) After that you need to call lambda function checkQueue
3) This function would first read all the details about current call (queue id, instance id, channel).
4) Then it will use Amazon Connect API to get realtime metrics data about the queue - Staffed and Error agents.
5) It would calculate the difference and return back Queue Out of service status.
6) If it returned OOS = false - your Queue is in service and you can use transfer block to transfer call to queue 
7) If OOS = true - Queue is out of service and you can offer client some alternative treatment:
      • callback
      • voicemail
      • transfer call to cell phone/external number
      • transfer call to another queue
      • simply play message "Please call us later" and disconnect)


Source code of this function you can find on my GitHub:

How to use it:

1) In your flow first add Set working queue block
2) After that add Invoke AWS Lambda function checkQueue


 3) After that use Check contact attributes to verify the output of lambda function.

If External attribute OOS = true -  Queue is out of service, otherwise, it is in service.




4) If Queue is OOS you can offer an alternative treatment to the client (in my case I just play announcement and disconnect call)
5) If Queue is in service - you can transfer call to Queue.

Some additional ideas:
  • the same checkQueue function can be used while the call is already waiting in the queue. Just add it to your customer queue flow. This would allow you to check if Queue is OOS in a loop, for example, once every 2-3 minutes.  If during the time client is waiting for an agent you can catch the situation when Queue goes to OOS. Again that would allow you to offer the client alternative treatment instead of waiting in the queue forever.
  • you can advise management that Queue is now OOS by sending Email/SMS/Task notifications. You just need to add additional Lambda blocks in your flow. You can read how to send SMS/Email/Task from IVR flows in my blog articles:



2022-01-03

Export users and queues to CSV-file in Amazon Connect

I created 2 simple Lambda functions that allow exporting users and queues to CSV files.


1. Export users to CSV

How it works:

  • Uses Amazon Connect API to fetch all available information about users
  • Saves it in CSV format
  • Uploads CSV to S3 bucket

Here is the source code of my Lambda function (using Python 3.9)

Before running this script you need to edit the following values:

#Amazon Connect InstanceID 

instance_id="513ab265-dd50-476b-976c-0ce5fac49907" 

 #csv-file name 

csv_file='/tmp/amazon_connect_users__'+dt_string+'.csv' 

 #S3 bucket name 

s3_bucket='amazon-connect-export'

 

Here is output format:

  • id  - id of user
  • username - username
  • firstname
  • lastname
  • email
  • phonetype  -  phone type SOFT_PHONE / DESK_PHONE
  • autoaccept - auto answer True/False
  • acw_timeout - after call work timeout
  • desk_number - phone number for Deskphone
  • security_profiles - list of security profiles, example = Agent|QualityAnalyst|CallCenterManager
  • hierarchy_group_name - agent hierarchy
  • routing_profile_name - routing profile
  • routing_profile_concurrency - concurrency configuration for routing profile - using following format CHAT|TASK|VOICE  (example - 4|10|1)
  • routing_profile_outbound_queue_name - default outbound queue for routing profile
  • routing_profile_details_list  - detailed configuration of routing profile in the following format:
    • QueueName1|Priority1|Delay1|Channel_type1,...QueueNameN|PriorityN|DelayN|Channel_typeN
    • Example:Tech_support|1|0|VOICE;BasicQueue|1|0|CHAT;BasicQueue|1|0|TASK;BasicQueue|1|0|VOICE


You can run it from Lambda or from AWS CLI. 

Example:
  • aws lambda invoke --function-name exportUsersToCSV --invocation-type Event return.json

2. Export queues to CSV

How it works:

  • Uses Amazon Connect API to fetch all available information about queues
  • Saves it in CSV format
  • Uploads CSV to S3 bucket

Here is the source code of my Lambda function (using Python 3.9)

Before running this script you need to edit the following values:

#Amazon Connect InstanceID 

instance_id="513ab265-dd50-476b-976c-0ce5fac49907" 

 #csv-file name 

csv_file='/tmp/amazon_connect_queues__'+dt_string+'.csv' 

 #S3 bucket name 

s3_bucket='amazon-connect-export'

 

Here is the output format:

  • id  - queue id
  • name - queue name
  • desc - queue description
  • status - queue status ENABLED/DISABLED
  • hours - hours of operation
  • ob_callerid_name - Outbound caller ID name
  • ob_phonenumber - Outbound caller ID number
  • ob_flow - Outbound whisper flow (optional)


You can run it from Lambda or from AWS CLI. 

Example:
  • aws lambda invoke --function-name exportQueuesToCSV --invocation-type Event return.json


2021-12-24

How to delete contact flow in Amazon Connect

 As you may know, it is impossible to delete contact flows directly from Amazon Connect web interface.

In the past, the only option was to rename unused flows by adding something like zzzz_ at the beginning of the name of contact flow.

Finally, AWS gives you the option to delete contact flows from AWS CLI or by using Amazon Connect API.

Example:

1. Go to AWS Management Console

2. Open AWS CLI (also known as AWS CloudShell)


3. Type following command

aws connect delete-contact-flow --instance-id <instance-id> --contact-flow-id <contact-flow-id>

Example:

aws connect delete-contact-flow --instance-id 818ab265-dd50-476b-976c-0ce5fac38847 --contact-flow-id 83e19628-86b7-4b8a-b343-2cb8e4249631


4. You would need to know instance-id of Amazon Connect

You can learn how to do it here (in the web interface)

https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html

Or you can type the following command in CloudShell:

aws connect list-instances 

and it would return all Amazon Connect instances


5. You would need to know contact flow id 

How to find out contact flow id:

https://docs.aws.amazon.com/connect/latest/adminguide/find-contact-flow-id.html

Or again you can do it directly in CloudShell:

aws connect list-contact-flows --instance-id <instance-id>


6. Last but not least.

You can also delete contact flow modules the same way:

aws connect delete-contact-flow-module --instance-id <instance-id> --contact-flow-module-id <contact-flow-module-id>

2021-12-12

Voicemail in Amazon Connect (part 2) - Sending voicemail to queue

In part 1 of this article, I gave an example of how to use Voicemail for Amazon Connect solution to be able to send voicemail from IVR to group email or to group cell phone as SMS.

Now I would like to show how to add the ability to send voicemail messages to Queue.

The idea is that we will piggyback on the Voicemail solution built by Amazon:

  • Whenever their solution does voicemail transcription it adds this information to DynamoDB table.
  • We will create Lambda function that is triggered when a new record is added to this table.
  • This lambda function in turn will gather all the available information about voicemail (voicemail timestamp, contact phone number,  queue name, voicemail transcript, URL to voicemail message)
  • It will then generate a Task that will have all this information and will send it to the queue.
  • An agent will receive a Task contact with all the available information about voicemail including transcript and link to a voicemail message that can be played back in the browser.

Here is how it is going to look like for agent:

1) Agent receives Task with title Voicemail
2) Agent accepts the task


3) Task contains all relevant info about the voicemail message
  • Contact Phone number         - caller id
  • Datetime - time when the client left a voicemail 
  • QueueName
  • QueueID  - this is a technical field that is required for the proper work of this solution
  • Voicemail Transcript
  • URL to the actual voicemail message





4) When Agent clicks on URL  - it will open player in the separate browser window, which gives agent option to listen to the actual voicemail message. 


5) Agent can also click on contactPhoneNumber and that will automatically initiate an outbound call.

Extra bonuses:
  • Since we already sent a voicemail to the queue it means that all the contact center stats and features (real-time reports, historical reports, contact search, Contact Lens) - will be automatically available
  • You can use all the available Amazon Connect KPIs  for voicemail
  • In the contact search you will see a voicemail transcript
  • If needed you can still be able to send voicemail by Email/SMS at the same time


If that is something that might be of interest to you - please follow this guide.


Step 1.

It is the same step that we had to do in part 1 of this article. So if you already did it in part 1 - no need to do it again.


We will start by implementing an official Voicemail for Amazon Connect solution.
It is fairly simple - just need to follow this implementation guide. It usually takes about 1 hour

https://docs.aws.amazon.com/solutions/latest/voicemail-for-amazon-connect/welcome.html

After it is implemented you need to test it and make sure it works, make sure that you can log in to Amazon Connect Voicemail Management Portal and can actually receive voicemail.


Step 2.

It is the same step that we had to do in part 1 of this article. So if you already did it in part 1 - no need to do it again.


Now we will create a "fake" agent account that will be used as a group voicemail box


  • First name = "VM"
  • Last name = must be equal to Name of Queue (for example "Tech_support")
  • Login name = must be equal to VM.<Name of the queue> (example VM.Tech_support)
  • Emal address - group email address that will be used to receive voicemails



Other parameters for this user can be anything you want because you would not need to log in to Amazon Connect with this user.



IMPORTANT:

For this solution to work correctly Login name must be in the following format
VM.<Name of the queue> (example VM.Tech_support)



Step 3.

It is the same step that we had to do in part 1 of this article. So if you already did it in part 1 - no need to do it again.

Now you need to login into your Amazon Connect Voicemail Management Portal.

1) Click on SYNC AGENTS button and your new user should appear in the list
2) Click on your VM user and configure it as required.
3) First thing you need to assign any extension that will be used to reference this agent in IVR.
In my case I assigned extension 7000.
4) Now you need to make sure to enable the following options:
  • Transcribe
  • Encrypt
  • Delivery Options - Email

This is required for the correct work of the solution. If you do not want to receive email notifications - you can assign to user a non-existent email address, but the delivery option must be enabled.





Step 4.

The next step is to create a new contact flow SendTask that is required to send tasks to the queue.



At first, we need to assign a working queue using Set working queue block.
  • Select Use attribute option.  
  • Type - User Defined
  • Attribute - QueueID

 

and after that our flow uses Transfer to queue block to actually transfer task to the queue.


You can download this flow from my GitHub:
https://github.com/contactcenterdude/amazon-connect/blob/main/Voicemail/SendTask-flow.json


Before we can move to the next step - you need to get Contact Flow ID that will be required in future steps.

  • Click on Show additional flow information.
  • In the ARN string Flow ID is the last 36 characters after contact-flow/





Step 5.

1. Go to AWS Management Console
2. Select DynamoDB
3. In the list of tables find 2 tables that have ContactVoicemailTable and UsersTable in the name.
These tables are automatically created when you install Voicemail solution.

In my case they have the following names: 
  • Amazon-Connect-Voicemail-VoicemailStack-1O9JZHZJ8ZD7Y-UsersTable-4DLIYWATXZ7T
  • Amazon-Connect-Voicemail-VoicemailStack-1O9JZHZJ8ZD7Y-ContactVoicemailTable-10UMQELMDZKAJ

Record their names, they will be required in future steps.


Step 6.

Now we will need to add lambda function create_Voicemail_Task that actually creates Task with voicemail info. This function is written in Python 3.9.


How it works:

  • gets info from ContactVoicemailTable. this table is used by Voicemail to keep results of voicemail transcription
  • if the transcription is completed it starts gathering data that will be added to Amazon Connect Task
      • contact phone number 
      • timestamp
      • queue name
      • queue id
      • URL to voicemail wav file
      • voicemail transcript
  • creates Amazon Connect Task

Source code available on my GitHub:
https://github.com/contactcenterdude/amazon-connect/blob/main/Voicemail/create_Voicemail_Task.py

************
You need to modify it before adding it to your instance:

In the lambda_handler function  provide info that is right for you: 

   # Region name of Amazon S3 and Amazon Transcribe
    region_name="us-east-1"
    
    # Amazon Connect InstanceId
    InstanceId="818ab265-dd50-476b-976c-0ce5fac38807"
    
    # FlowId of SendTask flow 
    ContactFlowId='5b67729d-21e7-4d3c-8a28-c96f881aa1a1'
    
    #name of DynamoDB table that is used by Voicemail to store voicemail users
    VoicemailTable="Amazon-Connect-Voicemail-VoicemailStack-1O9JZHZJ8ZD7Y-UsersTable-4DLIYWATXZ7T"

*************

After you add this lambda function I recommend increasing default timeout  (by default it is 3 seconds) to 10 seconds to give our function enough time to complete execution.
  • In AWS Management console open Lambda
  • Go to your function
  • Go to Configuration - General configuration
  • Click edit and change timeout to 10 seconds

Step 7. 

Before we can continue you have to add enough rights to the Role under which you will be running your lambda function.

Here is an example of a policy that I added to the role under which lambda function create_Voicemail_Task is running.


Before applying it you need to modify it for your case:
  • On line 8 - you need to specify ARN of your S3 bucket that is used for storing voicemails:
           "Resource": "arn:aws:s3:::amazon-connect-voicemail-vo-audiorecordingsbucket-z3v6jf3t44e7/*"
  • You can connect to S3 from the management console and find a bucket that has voicemail-vo-audiorecordingsbucket in the name.


Example 1 -- Role that is used for my lambda function


Example 2 -- Permissions for this role:




Step 8.

Now we need to add a trigger to our lambda function create_Voicemail_Task.
It will be triggered every time there is a new record added to ContactVoicemailTable table.
How to do it:
1) Go to Lambda and open our function create_Voicemail_Task
2) Click Add Trigger and create a new DynamoDB trigger

  • Trigger configuration - DynamoDB
  • DynamoDB table - find your ContactVoicemailTable
  • Batch size = 10
  • Starting position = TRIM_HORIZON
  • other configuration - by default
3) Save it
This is how it looks in my case.




Step 9. 

It is the same step that we had to do in part 1 of this article. So if you already did it in part 1 - no need to do it again.

Now we will create a module that will be doing all the magic of recording voicemail message and sending it to Email/SMS.




You can download this module from my GitHub:

https://github.com/contactcenterdude/amazon-connect/blob/main/Voicemail/Transfer_to_VM_module.json

Import it to your Amazon Connect instance.

Step 10.

It is the same step that we had to do in part 1 of this article. So if you already did it in part 1 - no need to do it again.

Now we can use our module in any IVR flow.

I created a simple VoicemailDemo flow. It emulates a situation when you want to offer client to leave a voicemail during non-working hours.


How it works.

1) At first I play the message "Our contact center is currently closed, please call us tomorrow. If you want to leave us a voicemail press 1".

2) If a client enters 1 

* First we need to add Set contact attributes block and assign voicemail user extension 7000 to user-defined attribute extensionNumber


* second - I invoke module Transfer_to_VM

And it is done. Transfer_to_VM module will do the rest.

Here is a full screenshot of VoicemailDemo flow


You can download it from my GitHub:

https://github.com/contactcenterdude/amazon-connect/blob/main/Voicemail/VoicemailDemo_flow.json

Step 11 (optional) .

It is the same step that we had to do in part 1 of this article. So if you already did it in part 1 - no need to do it again.

In steps 9 and 10 I gave you examples of how to offer the voicemail option in IVR before the call was transferred to queue.

What if you want to offer voicemail for the call that is already waiting in the queue?

I created another demo flow WaitInQueue_with_VM that demonstrates how to do it.

Important:

1) This is Customer queue flow so in order to use it you have to use Set customer queue flow in your main IVR before call is transferred to queue.

2) Amazon Connect does not allow to use of modules in Customer queue flows (hopefully this functionality would be added in the future). So I had to copy all the blocks from my module directly to customer queue flow.

3) Again, you have to assign an extension to extensionNumber attribute using Set contact attributes block like we did it before.


You can download this flow from my Github

https://github.com/contactcenterdude/amazon-connect/blob/main/Voicemail/WaitInQueue_with_VM_flow.json


**********

This solution is a little bit more complicated than my previous articles. So if you have any questions do not hesitate to contact me either in the comments or using the contact form on my site.



2021-12-11

Voicemail in Amazon Connect (part 1) - Group voicemail

 When Amazon Connect was first released back in 2017 many users were surprised that voicemail (and many other basic telephony features) were missing.

We are at the end of 2021 and still, voicemail is not a part of official functionality. Luckily things have changed. In 2020 Amazon introduced Voicemail as a separate solution that can be quite easily added to your instance of Amazon Connect. Plus there are some modifications of it developed either by AWS or by AWS partners.

You can easily add Voicemail by following this instruction:

https://aws.amazon.com/solutions/implementations/voicemail-for-amazon-connect/

Essentially it is a Voicemail/Auto-Attendant application that allows you to reach each individual agent (or user) of Amazon Connect by extension and leave a voicemail message if the person is not available. So basically it is a solution for personal voicemail boxes. Voicemail can be sent by Email and/or by SMS of the user, there is built-in Encryption and Transcription option (Speech to text). 

I find that this solution is missing some quite common features of voicemail that are sometimes used by contact centers:

1) Group voicemail.  

Very often contact centers offer to leave voicemail messages during non-working hours or when all agents are busy. In this case, voicemail is not associated with one user but generally associated with a group of agents.

2) Send voicemail to queue

In this case, voicemail message is sent to the queue and will be processed by the first available agent like any other type of contact. This is very similar to the callback option, except that voicemail allows clients to record a message with their voice, but generally, clients have expectations that someone from the contact center will listen to their message and contact them.

-------

The good news is that both of these features can be added to already existing Voicemail for Amazon Connect solution without major development.

In part 1 of this article, I would like to demonstrate how to add Group voicemail. Part 2 will be about sending voicemail to the queue. 

****************************

OK. So how can we add Group voicemail to Amazon Connect? Here is the process:

Step 1.

We will start by implementing an official Voicemail for Amazon Connect solution.

It is fairly simple - just need to follow this implementation guide. It usually takes about 1 hour.

https://docs.aws.amazon.com/solutions/latest/voicemail-for-amazon-connect/welcome.html

After it is implemented you need to test it and make sure it works, make sure that you can log in to Amazon Connect Voicemail Management Portal and can actually receive voicemail.

Step 2.

Now we will create a "fake" agent account that will be used as a group voicemail box


  • First name = "VM"
  • Last name = Name of Queue  (for example "Tech_support")
  • Login name = VM.<Name of the queue>   (example VM.Tech_support)
  • Emal address - group email address that will be used to receive voicemails

Other parameters for these users can be anything you want because you would not need to log in to Amazon Connect with this user.

Step 3.

Now you need to login into your Amazon Connect Voicemail Management Portal.

1) Click on SYNC AGENTS button and your new user should appear in the list

2) Click on your VM user and configure it as required.

3) First thing you need is to assign any extension that will be used to reference this agent in IVR.

In my case, I assigned extension 7000.

4) Now you might want to enable some of these features depending on your requirements.

In my example  I enabled everything:

  • Transcribe
  • Encrypt
  • Delivery Options - Email
  • Delivery Options - SMS
  • Added cell phone number for SMS delivery



Step 4.

Now we will create a module that will be doing all the magic of recording voicemail message and sending it to Email/SMS.

I almost did not have to develop anything myself. I just took 2 standard flows that come with this Voicemail solution - VM-Greeting.json and VM-Agent.json, combined them into 1 module that is called Transfer_to_VM that will work this way:

1) Instead of asking a client to enter an agent extension we will pass the extension to our module using contact attribute

2) I removed all the verifications of user availability - we do not need them because we want to force transfer to voicemail

3) After that it pretty much follows the algorithm of standard VM-Greeting & VM-Agent - uses Lambda function to find a configuration of the user and starts media streaming & recording, that later will be transcribed by Amazon Transcribe and sent to email and/or SMS depending on how you configure it.



You can download this module from my GitHub:

https://github.com/contactcenterdude/amazon-connect/blob/main/Voicemail/Transfer_to_VM_module.json

NOTE:  On line 235  you need to change the name of lambda function to match your configuration.

Import it to your Amazon Connect instance.

Step 5.

Now we can use our module in any IVR flow.

I created a simple VoicemailDemo flow. It emulates a situation when you want to offer the client to leave a voicemail during non-working hours.

How it works.

1) At first I play the message "Our contact center is currently closed, please call us tomorrow. If you want to leave us a voicemail press 1".

2) If the client enters 1 

* First we need to add Set contact attributes block and assign voicemail user extension 7000 to user-defined attribute extensionNumber


* second - I invoke module Transfer_to_VM

And it is done. Transfer_to_VM module will do the rest.

Here is a screenshot of VoicemailDemo flow


You can download it from my GitHub:

https://github.com/contactcenterdude/amazon-connect/blob/main/Voicemail/VoicemailDemo_flow.json

Step 6 (optional) .

In steps 4 and 5 I gave you examples of how to offer a voicemail option in IVR before the call was transferred to the queue.

What if you want to offer voicemail for the call that is already waiting in the queue?

I created another demo flow WaitInQueue_with_VM that demonstrates how to do it.

Important:

1) This is Customer queue flow so to use it you have to use Set customer queue flow in your main IVR before the call is transferred to the queue.

2) Amazon Connect does not allow the use of modules in Customer queue flows (hopefully this functionality would be added in the future). So I had to copy all the blocks from my module directly to customer queue flow.

3) Again, you have to assign an extension to extensionNumber attribute using Set contact attributes block like we did it before.


You can download this flow from my Github

https://github.com/contactcenterdude/amazon-connect/blob/main/Voicemail/WaitInQueue_with_VM_flow.json

NOTE:  On line 448  you need to change the name of lambda function to match your configuration.

****************

So there you have it - we can now add Voicemail option to your IVR:

  • before the call was transferred to the queue 
  • while the call is waiting in the queue

In both cases, a voicemail message will be sent to an email address  (or phone number for SMS) that is associated with a "fake" user account. 

Positive side of this configuration:

  • easy to setup
  • does not require custom development

Negative side:

  • It is not ideal from a management perspective - since it does not generate any stats
  • Someone needs to constantly monitor your group email address (or cell phone number) to be able to reach clients that left voicemail messages

With some customizations and by using Tasks it is possible to send voicemails to Queue and that will automatically take care of stats and management.

Stay tuned for part 2 of this article where I would explain how to do it.

2021-12-09

SLA Notifications in Amazon Connect

One of the most important KPIs of any contact center is SLA (service level agreement). It shows the percentage of the calls that were answered before the threshold. For example, 80% of the calls must be answered before 20 seconds of waiting in line.

Since it is such an important metric quite often contact center management would like to be informed about it, so they could act quickly to improve SLA for example by adding more agents on the line.

Of course, you can see SLA in historical and real-time reports, but in this article, I would like to demonstrate how to create automated SLA notifications that will be sending SLA metrics every hour by SMS or by EMail.

In my example, I will be sending SLA notifications every hour for the previous hour. This can be modified based on requirements.

Step 1. 

I will start by creating DynamoDB table that will be used to keep configuration for each Queue.

DynamoDB table - SLA_Notifier with following attributes

  • QueueId     - QueueId in Amazon Connect (see below where to find QueueId)
  • QueueName   - Queue name
  • Channel     - a type of channel (VOICE, CHAT, TASK).  You need this field because normally you would have different SLAs for each type of contact (calls, chats, tasks).
  • Threshold  - SLA threshold (for example 20 seconds)
  • SendEmail   - yes/no. Do you want to send SLA notifications by Email?
  • SendSMS     - yes/no. Do you want to send SLA notifications by SMS?
  • email       - send Email to this address
  • phoneNumber - send SMS to this phone number 



* Where to find QueueID:

1. Connect to Amazon Connect interface
2. Go to Routing - Queues
3. Select desired Queue
4. Click "Show additional queue information"
5. Take the last 36 characters in ARN field after queue/ - this is QueueID



Step 2.

I created Lambda function SLA_Notifier using Python 3.9 that does the following:

1) grabs all data from DynamoDB table SLA_Notifier
2) for each queue in the table it gets SLA for the last X minutes. Where X is configurable.
3)  for each line in the table it identifies if we need to send SMS and/or send Email
4)  sends SMS and/or EMail as required

Source code of this function on my GitHub:

Before you can use it you have to configure the following parameters 

************
    # Amazon Connect InstanceId
    InstanceId="838ab265-dd60-476b-976c-0ce5fac44809"
    
    #Statistical interval in minutes (SLA for last X minutes)
    statInterval="60"
    
    # Region name of Amazon SES and Amazon SNS
    region_name="us-east-1"
    
    # MailFrom for EMail notification
    MailFrom = "sla_notifier@ecorp.com"
    
    # Subject for EMail notifications
    Subject='SLA Notifier'

**************

Read this article to find your Amazon Connect InstanceId



IMPORTANT:
 In my example, I assume that you already configured Amazon SES so that you would be able to send emails using MailFrom address. 

*******

After you add this lambda function I recommend increasing default timeout  (by default it is 3 seconds) to 10 seconds to give our function enough time to complete execution.
  • In AWS Management console open Lambda
  • Go to your function
  • Go to Configuration - General configuration
  • Click edit and change timeout to 10 seconds


Step 3.

The last step is to create a schedule to run our Lambda function every hour.
To do that do the following:

1. In AWS console select Amazon EventBridge
2. Go to Rules
3. Click "Create rule"
4. Specify rule name (for example "SLA_Notifier")
5. Define pattern - select "Schedule"
6. Select "Cron expression"
7. Enter following cron expression 0 * * * ? *
It means that our rule will be triggered at 0 minutes of every hour.
8. Scroll down to "Select targets"
9. In the Target list select "Lambda function"
10. And select our function "SLA_Notifier"


11. Save this rule

*****************************

Some possible modifications:

1) The same way I send SLA it is easy to add additional metrics to notifications.
Anything that can be returned by GetMetricData function of Amazon Connect API can be easily added to the notification.
2) You can add extra logic and only send notifications if SLA (or any other metric) is within a certain range (for example if SLA drops below 70%)
3) You can adjust statistical interval and cron expression to send notifications more or less often.