Showing posts with label Emergency Messages. Show all posts
Showing posts with label Emergency Messages. Show all posts

2021-12-07

Emergency Messages in Amazon Connect (part 3)

In part 2 of this article, I demonstrated how to create Admin IVR to be able to enable/disable emergency messages using the phone menu.

Right now our Admin IVR has no protection so anyone can dial it and fiddle with emergency messages.

There are multiple options on how to add security to our IVR menu such as:

1) Option 1 - easiest option would be to add a numeric password that will be hardcoded directly in Admin IVR. You ask users to enter the password first and if it is correct proceed with normal Admin IVR behavior.

This option is OK if you have a small number of users (ideally 1 user only).

2) Option 2 - create a user table that contains an individual numeric password for each user. 

Optionally you can add phone numbers to user table and limit access for each user only if they dialed from a specific phone number (for example corporate cell phone number).

3) Option 3 - use VoiceID to add authentication by voice.

In this article, I would like to show how to use DynamoDB table to add authentication to Admin IVR - option 2.


Step 1.

I created DynamoDB table EmergencyMessagesAdmin with the following attributes:
  • PIN   - unique PIN code assigned to each user
  • FirstName  
  • LastName



Step 2.

Next step we will need a new Lambda function checkEmergencyMessagesAdmin to verify if the PIN code matches.

What it does:

  • takes PIN codes as input and verifies if there such PIN code in EmergencyMessagesAdmin
  • if yes returns Valid = 1
You can download source code from my GitHub:

https://github.com/contactcenterdude/amazon-connect/blob/main/EmergencyMessages/checkEmergencyMessagesAdmin.py

Step 3.

Now let's update the existing flow EmergencyMessagesAdmin.


Right at the beginning of the flow, we will ask user to enter PIN-code and then use our lambda function checkEmergencyMessagesAdmin to verify if it is a valid user.


If it is a valid user -> we will offer a standard IVR Admin menu.



You can download source code from my GitHub:

Emergency Messages in Amazon Connect (part 2)

 In this article, I would like to continue talking about Emergency Messages in Amazon Connect.

In part1 I explained how to add Emergency Messages in your existing IVR. Now I would like to talk about how to disable/enable them using Admin IVR.

As described in part1 we already have DynamoDB table EmergencyMessages that contains information about our Emergency Messages. 

So what options do we have to update this table?

1) Option1  - connect to DynamoDB and change values directly in the table. This option is situable for system administrators, regular users would not have access to the table.

2) Option 2 - create a web interface that would allow us to manage Emergency Messages. This is probably the most user-friendly option but it requires web development.

3) Option 3 - create Admin IVR that allows to Enable/Disable emergency messages. 

I would like to give you an example of how to implement Option 3.


Step 1.

I created Lambda function using Python 3.9 which is called UpdateEmergencyMessage.

It takes 2 input parameters:

  • MessageID  -  ID of Emergency Message
  • Status  - current status of the message
After that, it changes the status of the emergency message from the current one to the opposite (Enabled to Disabled, Disabled to Enabled) and updates DynamoDB EmergencyMessages table

You can download source code from my GitHub:

https://github.com/contactcenterdude/amazon-connect/blob/main/EmergencyMessages/UpdateEmergencyMessage.py


Step 2.

Now we will create a new IVR flow EmergencyMessagesAdmin.

How it works:

1) At first we will ask a user to enter ID of the Emergency Message.

2) After that we will use the existing lambda function CheckEmergencyMessage to check the current status of this message

3) We will play back the user current status of the message

4) After that I offer the user 2 options

  • Press 1 - to change the status of the message
  • Press 2 - to play text of the message (might be helpful to verify if you are actually changing the right thing)
5) If the user pressed 1 - I will call Lambda function UpdateEmergencyMessage to change the status of the message.

6) After that I will call again lambda function CheckEmergencyMessage to verify the new status of the message and playback to user new status



You can download the flow from my GitHub:

https://github.com/contactcenterdude/amazon-connect/blob/main/EmergencyMessages/EmergencyMessagesAdmin_flow.json

Step 3.

Now you just need to assign a phone number to Admin IVR flow.

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


Ok. Admin IVR is now ready but something seems to be still missing.

Well, right now anyone can dial this Admin IVR and disable/enable emergency messages. There is almost no protection. Stay tuned for part 3 of this article where I would discuss options of adding a security layer to Admin IVR.

 

2021-12-06

Emergency Messages in Amazon Connect (part 1)

In this article, I would like to demonstrate how to add Emergency Messages in Amazon Connect.

Let's say you have an IVR and would like to be able to enable/disable certain messages or certain treatment without changing the whole IVR.

Usually, this is required in case of emergency situations or under some special circumstances.
Emergency Messages can also be called Special Messages.   

I will split this article into 3 parts:
  • Part 1 - how to add emergency messages to IVR menu
  • Part 2 - how to enable/disable emergency messages using Admin IVR
  • Part 3 - adding security to Admin IVR

Also very recently Amazon added new functionality to Amazon Connect - now you can create reusable call flows that are called Modules. In my example below I will use modules because it allows me to reuse the same module multiple times, makes my call flow much cleaner, and is easier to read.

You can learn more about modules in the official Amazon Connect documentation

Another thing that I would like to point out - in my example I use text to speech for emergency messages.
This seems to be straightforward, but If your emergency message is pre-recorded prompt you can still easily do it, just by adding prompt name as one of the attributes in DynamoDB table (step 1) and some extra logic in the module (step 3).

Step 1.

First, we need to create DynamoDB table EmergencyMessages that will be used to store Emergency Messages configuration and would allow to control what should happen after we played Emergency Message.

Here is a list of attributes:

  • id       - unique id of emergency messages. In my case, I use 4-digit long numbers
  • Enabled -  true / false   - status of Emergency Message
  • Description - description field for each emergency message
  • Text -  Actual text of an emergency message that will be played to the client
  • Action - what to do with the call after we played Emergency Message (see table below)
  • ActionTarget - additional property of action (see table below)

Possible values for Action and corresponding ActionTarget:
Action ActionTarget Comment
<EMPTY> <EMPTY> Do nothing. Just play Emergency Message and continue IVR flow as usual
DISCONNECT <EMPTY> Disconnect the call after the message
CALLBACK <QUEUE name> After the message create callback request for <QUEUE name>
TRANSFER_NUMBER <phone number> After the message transfer call to <phone number>
TRANSFER_QUEUE <QUEUE name> After the message transfer call to <Queue name>


Step 2.

Next step - I created Lambda function CheckEmergencyMessage using Python 3.9 that checks the status of Emergency Message and returns all attributes.

Input:
  • MessageID - id of the message
Output:
  • Enabled
  • Text
  • Action
  • ActionTarget


Source code of my lambda function you can see on my GitHub:


Step 3.

Now we will create a module CheckEmergencyMessage. As I previously mentioned modules are the new way to create reusable call flows.

What it does
  1. Invokes Lambda function CheckEmergencyMessage
  2. Checks if an emergency message is Enabled. 
    1. If it is not enabled - exits module
    2. If it is Enabled - plays text using text-to-speech
      • After that uses values of Action and ActionTarget to decide what to do with the call


You can download the source code of this module from my Github.

Step 4.

The last step is to create a demo flow that actually uses Emergency Messages.

What it does:

1. First I play a welcome message, something like "Welcome to customer support"

2. I assign the value of emergency message to attribute MessageID using Set Contact Attributes block

In this example MessageID = 2001

3. After that I invoke module CheckEmergencyMessage that actually checks if this emergency message is Enabled and plays it back to the customer and performs the required Action.


You can download the source code of this module from my GitHub:

https://github.com/contactcenterdude/amazon-connect/blob/main/EmergencyMessages/EmergencyMessagesDemo_flow.json


******

I would like to add that by adding the ability to create modules  Amazon Connect made it much easier to develop solutions like this one. Before that, I would have to add a whole bunch of blocks right directly in the main IVR flow. Now I can just 2 blocks at any place of my IVR to add additional Emergency Messages.