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.

No comments:

Post a Comment