AWS Contact Center

Preventing duplicate callback requests in Amazon Connect

Preventing duplicate callback requests in Amazon Connect

Callback mechanisms are important in contact centers today because it allows callers to reserve their place in the queue without actually staying on the line. When their turn in the queue arrives, they receive an automatic callback from the contact center saving them precious time and providing an enhanced customer experience. This feature also helps businesses maintain their queue metrics and overall costs.

However, sometimes customers can be impatient. They can end up calling repeatedly and consequently registering for multiple callbacks. Being able to prevent this improves customer experience, as callers will no longer receive multiple callbacks for the same query. In addition, it also enhances agent productivity as they are not initiating multiple unnecessary callbacks to the same customer for the same query.

This blog post walks you through a solution that will prevent multiple callback attempts by your callers, using Amazon Connect, AWS Lambda and Amazon DynamoDB.

Pre-requisites

This blog assumes you have:

  • An Amazon Connect Contact Center Instance
  • A basic understanding of AWS CloudFormation
  • A basic understanding of Amazon DynamoDB
  • A basic understanding of AWS Lambda

Solution overview

Architecture for capturing the number of callback requests attempted by customer

In the above architecture, we will maintain a database named Callback Database using Amazon DynamoDB that keeps records of customers who have requested for a callback. When a customer calls into the contact center, Amazon Connect will pass the phone number that was requested by the customer to receive a callback on, as an Amazon Connect Contact Attribute of the call. The first invocation of AWS Lambda named Read Callback will check if the calling number has a record in the Callback Database with a matching queue name. If there is a record, Amazon Connect will play a message to the caller asking them to be patient, as they already have a callback request queued. If there is no record then the caller will be allowed to proceed and request a callback. Once their request is confirmed we write the phone number, and Amazon Connect Contact Attributes such as Contact Id, queue name and timestamp to the Callback Database using the AWS Lambda function named Write Callback.

 

Architecture for capturing the number of callbacks dialled out by Amazon Connect

In the above architecture, once a callback attempt has been made to the caller we leverage the Outbound Whisper flow, to invoke an AWS Lambda function named Delete Callback to remove the customer record from the Callback Database.

At the moment there is no disconnect flow for voice calls where either the agent or customer has hung up first, so we decided to remove the callback entry in the database on the first attempt of the callback.

We chose the first attempt in the event that the customer answered the first callback we would not see subsequent attempts. In this AWS Lambda function, we first look up the entry by phone number and queue name. If we have a match we can delete the item.

Steps to get started

Create AWS Lamba functions and Amazon DynamoDB using AWS Cloudformation

We will use an AWS CloudFormation template to programmatically create the AWS Identity and Access Management roles, the AWS Lambda functions as well as the DynamoDB (Callback Database) table needed for our solution. The AWS Lambda functions (readcallback , writecallback, removecallback) are used to read, write, or delete callback phone numbers and other information in a DynamoDB table. The IAM Roles allow the AWS Lambda Functions to have read, write or delete access to the Callback Database and access to the Amazon Cloudwatch logs.

  1. Log in to your AWS Management Console.
  2. Confirm that the AWS Region selected has the Amazon Connect service available.
  3. Click on the button below “Launch Stack” to create a stack called ‘Callback’.

  1. On the AWS CloudFormation page, modify the stack name if you prefer a different one.
  2. To follow security best practices, change the ConnectInstanceID to be your Amazon Connect Instance Id, however if you choose this CloudFormation stack to be deployed in several Amazon Connect instances set this value to *.
  3. If you do change the stack name, the text in this document referencing the Callback stack can be replaced by your chosen stack name.

  1. Click the Create stack button after selecting all three checkboxes.

Grant Amazon Connect permission to execute your AWS Lambda function

To grant your Amazon Connect instance permission to invoke the AWS Lambda functions we created follow the steps below. For additional information, see the Amazon Connect Administrator guide.

  1. In the Amazon Connect console, choose Contact Flows and scroll to the bottom of the page in the AWS Lambda section.
  2. On the Function drop-down menu, select the readcallback function and click on + Add AWS Lambda Function, as shown in the following screenshot:

  1. Repeat step 3 for the writecallback and removecallback functions.
  2. You should have a total of three AWS Lambda Functions:

Import and configure the Amazon Connect contact flow

  1. Download the contact flow called Callback.
  2. Log in to your Amazon Connect Console.
  3. On the left side of the Amazon Connect console, select Routing -> Contact Flows
  4. Click the Create contact flow button at the top-right
  5. Click the drop-down at the top-right and select Import Flow
  6. Click the Select button and select the downloaded Callback file from step 1 above.
  7. Remove and recreate the Set working queue block to be the queue you wish to use.

  1. Click on the header for the first Invoke AWS Lambda function and select the readcallback AWS Lambda function from the dropdown list or enter the ARN for the second readcallback AWS Lambda function.

  1. Click on the header for the second Invoke AWS Lambda function and select the readcallback AWS Lambda function from the dropdown list or enter the ARN for the first readcallback AWS Lambda function.

 

  1. Click on the header for the third Invoke AWS Lambda function and select the writecallback function from the dropdown list or enter the ARN for the writecallback AWS Lambda function.

 

  1. Save and Publish your contact flow.

Import and configure the Amazon Connect outbound contact flow

  1. Download the pre-built contact flow called Callback_Outbound.
  2. On the left side of the Amazon Connect console, select Routing -> Contact Flows.
  3. Click on the Create contact flow drop-down menu and select Create outbound whisper flow:

  1. Click the drop-down at the top-right and select Import Flow.
    Click the Select button and select the downloaded Callback_Outbound file from step 1 above:

  1. Click on the header for the “Invoke AWS Lambda function” and select the removecallback function from the dropdown list or enter the ARN for the removecallback AWS Lambda function.
  2. Save and Publish your contact flow.

Associate an outbound whisper flow with your queue

  1. In your Amazon Connect console, choose the Routing icon from the navigation bar, and choose Queues.
  2. Select the queue you in which you wish to receive the callbacks
  3. Assign the newly created contact flow named ‘Callback outbound’ to the Outbound whisper flow (optional) drop down.

  1. Ensure the Outbound caller ID number is set to a phone number in your instance by selecting it from the drop down by selecting a number in the Outbound caller ID number drop down.
  2. Click Save.

Associate a phone number with your contact flow

  1. In your Amazon Connect console, choose the Routing icon from the navigation bar, and choose Phone numbers.
  2. Associate a phone number with Callback contact flow from the Contact flow/ IVR drop-down menu, and choose Save.

Testing our solution

Now that we have our set up ready, let’s test the solution:

  1. Ensure all agents are unavailable by either not having any agents logged in, or having the agents remain offline.
  2. Call the phone number you set for your Callback Contact Flow / IVR.
  3. You should hear a message that says all agents are busy.
  4. You will also be prompted with your calling number (ANI), and given an option to enter a new number, or just given an option to enter a number if your caller Id (ANI) is blocked. Enter your preferred number as instructed.

This number will be written into the DynamoDB database. Let us test what happens when we place a second call into the queue.

  1. Call the phone number you set for your Callback Contact Flow / IVR.
  2. You should hear a message stating you have a callback in the queue already.

Now we have confirmed that we cannot have duplicate callbacks, let us log an agent in, and receive the callback in the system:

  1. Log in as an agent. Set yourself as “Available”. Wait to receive the call in the queue which was requested as a callback. Accept the call when it lands on the agent softphone.
  2. Once the callback has been placed, irrespective of whether you (or in production, the customer) answer the call or not, the entry for the callback request will be deleted from the Callback database.

Note: At the time of writing this Blog, Disconnect Flows for voice calls is not available. Because of this, we placed the Lambda on the Outbound whisper flow, which invoked the function each time the flow is used. This means that it the phone number will be removed from the Callback database on the first attempt. If the caller calls back after the first attempt, the callback would be allowed to proceed. There is the potential for the caller to call again after the first callback attempt, and request a second callback.

In this blog post we implemented a solution where we avoided duplicate callback attempts by the same caller by tracking the Callbacks in a DynamoDB Table and hence, can ensure increased productivity of the contact center.