Showing posts with label Voicemail. Show all posts
Showing posts with label Voicemail. Show all posts

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.