AWS Contact Center

Routing contacts based on performance objectives in Amazon Connect: Service level (part 1)

Enterprise contact centers have performance objectives (service levels, agent occupancy, average speed to answer) to deliver a high-quality customer service experience. The strategies used to route incoming contacts have a direct influence on these performance metrics. Amazon Connect makes it possible to route contacts based on objectives that are important to the business. This is a multi-part blog post series to personalize and adapt routing in Amazon Connect based on performance objectives. Part 1 focuses on customer facing metrics like service level. Part 2 will focus on resource management metrics like agent occupancy (utilization).

Service level is the percentage of contacts answered within a given amount of time. With legacy providers, contact center managers are forced to react by juggling staffing across queues to maintain service levels. This constant firefighting is stressful, and counterproductive.

This blog post demonstrates how to route contacts based on service level objectives. The solution compares the current service level to the configured threshold, and makes routing decisions to meet service level objectives for the organization. These decisions could be routing to alternate queue, offering a callback, or reprioritizing the contact in the queue.

Solution overview

This blog post deploys an application to demonstrate routing based on service level objective. For example, consider a service level objective of 70% within 30 seconds. If 70% or more calls are answered within 30 seconds, the organization is meeting the service level objective. If less than 70% of the calls are answered within 30 seconds, the organization is not meeting the service-level objective. Service level is measured over a time period. Businesses may have different service level objectives between queues or customer segments.

Solution flow


In the preceding architecture, the following sequence of steps takes place for an incoming contact:

  1. Customer initiates a contact for service into a contact center.
  2. Amazon Connect contact flow determines which queue to route the call to, and invokes an AWS Lambda function.
  3. AWS Lambda function checks results table (queueMetricResultsTable) in Amazon DynamoDB for the current service level metric and threshold configured for the queue.
  4. If the metric validity is about to expire or is not found, AWS Lambda function updates the table to request a refresh of the metric.
  5. Amazon DynamoDB Streams invoke another AWS Lambda function to refresh the metric.
  6. Lambda function gets configuration values from queueMetricConfigTable in Amazon DynamoDB.
  7. Lambda function queries Amazon Connect for service level metrics.
  8. Lambda function updates the queueMetricResultTable.
  9. Amazon Connect contact flow uses the service level metric to determine the appropriate routing action.

Deployment walkthrough

Prerequisites

For this walkthrough, you should have the following prerequisites:

Step 1: Get Amazon Connect instance details

    1. Sign in to the AWS Management Console and open the Amazon Connect console.
    2. Select the Amazon Connect instance, and make a note of the instance id. This is the last part of the instance ARN (Amazon Resource Name) after the forward slash.

Step 2: Launch CloudFormation template

The AWS CloudFormation template creates the following resources required for this solution:

  1. Two Lambda functions getMetricsLambdaFunction, and checkMetricsLambdaFunction.
  2. Two DynamoDB tables – queueMetricsConfigTable, and queueMetricsResultsTable.
  3. One DynamoDB stream.
  4. One Amazon Connect contact flow – ServiceLevelExampleContactFlow.
  5. One IAM policy and one IAM role for Lambda function to access DynamoDB.
  6. One resource-based policy for Amazon Connect to invoke AWS Lambda.

Follow the steps to deploy the template:

    1. Launch the CloudFormation template in the same Region as your Amazon Connect instance.

    1. Accept the default values and choose Next.
    2. Enter Amazon Connect instance id from step 1 in the Amazon Connect Instance Id field. Provide a stack name (for example, Service-Level), and choose Next.

    1. Choose Next, and scroll down to the bottom of the page.
    2. Acknowledge IAM resources creation, and choose Create stack. This will take couple minutes to provision the resources.

Step 3: Configure service level routing

    1. Open the Amazon Connect console.
    2. In the navigation pane, under Routing, choose Queues.

    1. Select BasicQueue, and make a note of the Amazon Resource Name (ARN) of BasicQueue.

  1. Create a new queue (alternate).
    1. On the navigation menu, under Routing, choose Queues.
    2. Choose Add new queue.
    3. Add appropriate information about the queue and choose Add new queue.
    4. Select this newly created queue, choose Show additional queue information. Make a note of the ARN for this queue.
    5. Assign the queue to a routing profile.

    Step 4: Update queueMetricConfigTable in Amazon DynamoDB 

      1. Open the Amazon DynamoDB console.
      2. In the navigation pane, choose Tables.
      3. Select the table with queueMetricConfigTable in the name.

      1. In the navigation pane, choose Explore items, and choose Create item on top-right to create a new item.

      1. On Item editor window, select JSON on the top-right. Uncheck View DynamoDB JSON.

      1. Replace existing item with the following JSON in Item editor. Replace <Enter BasicQueue ARN> with the ARN of your BasicQueue. Replace <Enter alternate queue arn 1> with ARN of the alternate queue noted in step 3. For this example, replace both, alternate queue arn 1, and alternate queue arn 2, with the same alternate queue ARN. These can be different queues based on your use case.
    {
       "queue_name": "BasicQueue",
       "refresh_rate_secs": 180,
          "svl_params": {
             "1": {
    	    "alt_queue_arn": "<Enter alternate queue arn 1>",
                "svl_obj": "80",
                "svl_thresh": "30"
              },
    	"2": {
    	   "alt_queue_arn": "<Enter alternate queue arn 2>",
    	   "svl_obj": "80",
    	   "svl_thresh": "60"
             }
          },
          "queue_arn": "<Enter BasicQueue ARN>"
    }
    1. Choose Create item to create an item in this table.

    Step 5: Validate Lambda functions

    1. Validate Lambda function with name getMetrics.
        1. Open the AWS Lambda console.
        2. Select Lambda function containing getMetrics in the name.

        1. This Lambda function uses an environment variable LAST_X_SECONDS to calculate and retrieve service level metric for a specific start and end time. In this example, the value is set to 14400 seconds (effective 12:00 A.M. of current day). This value is used in getMetricData API, and can be adjusted based on your requirements.

        1. Under Test, choose select Create new event, enter Event name (for example, Test1), and Private to configure the following test event.

        1. Enter Event JSON
        2. Copy the following JSON, and paste it replacing existing default event.
      {
        "Records": [{
      	"dynamodb": {
      	  "NewImage": {
      	     "queue_name": {
      	        "S": "BasicQueue"
      	      },
      	     "refresh_metrics": {
      		"S": "Y"
      	     }
                }
      	}
         }]
      }
        1. Choose Save to create the event.
        2. Choose Test to validate the Lambda function. A statusCode: 200 response completes the test successfully.

  2. Validate Lambda function with name checkMetrics.
      1. In the AWS Lambda console, choose function containing checkMetrics in the name.
      2. Under Test, choose select Create new event, enter Event name (for example, Test1), and Private to configure the following test event.

      1. Enter Event name (for example, Test1).
      2.  Copy the following JSON and paste it replacing existing default event.
    {
      "Details": {
        "Parameters": {
           "QueueName": "BasicQueue",
           "SvlThreshold": "30"
         }
       }
    }
      1. Choose Create to create the event.
      2. Choose Test to validate the Lambda function. A statusCode: success response completes the test successfully.

    Step 6: Configure Amazon Connect

      1. Sign in to the Amazon Connect console.
      2. On the navigation pane, under Routing, choose Phone Numbers.
      3. Choose Claim a number to claim a new phone number, or use an existing phone number if you have obtained previously.
      4. Assign the phone number to the contact flow with name containing ServiceLevelRoutingExample.

    Choose Save.

    Step 7: Testing
    Service level metric is updated as contacts are placed in a queue, and are routed to agents. To test this capability, the solution prompts for a threshold service level. If current service level metric is lower than the threshold entered, the contact flow routes the call to the primary queue. If it is higher, the call is routed to an alternate queue.

    1. Configure a routing profile in Amazon Connect with BasicQueue and an alternate queue.
    2. Configure an agent with this routing profile.
    3. Log in an agent. Optionally, you can have a second agent configured with the alternate queue in their Routing Profile.
    4. Set agent status to Offline in the Control Contact Panel (CCP).
    5. Place a test call
      1. You will be prompted to enter a service level threshold value.
      2. Enter the service level threshold seconds (for example, 30), followed by a #.
    6. Wait in the queue for a few seconds.
    7. Change agent status to Available.
    8. Accept the call, wait a few seconds, and End the call.
    9. Repeat steps 5 through 8 to place multiple calls. Use the same service level threshold value for all test calls. Wait in queue for a varying number of seconds; some higher than the threshold, and some lower.

    Placing multiple calls updates the service level metric for testing the thresholds, and taking the next action. For this test, the contact flow routes the call to BasicQueue if the service level metric is lower than the threshold value. If service level metric exceeds the threshold, contact is routed to an alternate queue.

    You’ve successfully configured and tested service level routing with your Amazon Connect instance.

    Clean up

      1. Sign in to the Amazon Connect console.
      2. On the navigation pane, under Routing, choose Phone Numbers.
      3. Select the phone number with ServiceLevelRoutingExample contact flow and select x to remove the mapping of phone number to the contact flow.
      4. Click Save.

      1. Navigate to CloudFormation console, select the Service-Level stack, and choose Delete.
      2. Delete the stack by choosing Delete stack on confirmation screen.

    Conclusion

    In this post, we implemented service level routing using Amazon Connect by completing the following steps:

    • Deployed CloudFormation stack that included AWS Lambda functions, Amazon DynamoDB tables, and Amazon Connect Contact flow.
    • Configured Amazon DynamoDB table, and Amazon Connect.

    Service level metric is an indicator of contact center availability to service customers. This blog post demonstrated how to route contacts based on service level objectives.  Customers can be routed to an alternate queue, or offered callback to improve the experience. You can enhance the solution based on your organization’s requirements and reduce the need to make manual intraday adjustments.

    With Amazon Connect, you pay for what you use. There are no upfront payments, long-term commitments, or minimum monthly fees. The price metrics are detailed on Amazon Connect pricing.

    Should you need help with setting this up, you can get assistance from AWS Professional Services. You can also seek assistance from Amazon Connect partners available worldwide.