Field Notes: Build Dynamic IVR Menus with Amazon Connect and AWS Lambda
AWS Architecture BlogField Notes: Build Dynamic IVR Menus with Amazon Connect and AWS Lambdaby Marius Cealera | on27 JUL 2021| inAmazon Connect,Architecture,AWS Lambda,Technical How-to|Permalink|ShareThis post was co-written by Marius Cealera, Senior Partner Solutions Architect at AWS, and Zdenko Estok, Cloud Architect and DevOps Engineer at Accenture.Modern interactive voice response (IVR) systems help customers find answers to their questions through a series of menus, usually relying on the customer to filter and select the right options. Adding more options in these IVR menus and hoping to increase the rate of self-serviced calls can be tempting, but it can also overwhelm customers and lead them to ‘zeroing out’. That is, they select to be transferred to a human agent, defeating the purpose of a self-service solution.This post provides a technical overview of one ofAccenture’s Advanced Customer Engagement (ACE+)solutions, explaining how to build a dynamic IVR menu inAmazon Connect, in combination withAWS LambdaandAmazon DynamoDB. The solution can help the zeroing out problem by providing each customer with a personalized list of menu options. Solutions architects, developers, and contact center administrators will learn how to use Lambda and DynamoDB to build Amazon Connect flows where menu options are customized for every known customer. We have provided code examples to deploy a similar solution.Overview of solution“Imagine a situation where a customer navigating a call center IVR needs to choose from many menu options – for example, an insurance company providing a self-service line for customers to check their policies. For dozens of insurance policy variations, the IVR would need a long and complex menu. Chances are that after the third or fourth menu choice the customers will be confused, irritated or may even forget what they are looking for,” says Zdenko Estok, Cloud Architect and Amazon Connect Specialist at Accenture.“Even splitting the menu in submenus does not completely solve the problem. It is a step in the right direction as it can reduce the total time spent listening to menu options, but it has the potential to grow into a huge tree of choices.”Figure 1. A static one-layer menu on the left, a three-layer menu on the rightOne way to solve this issue is by presenting only relevant menu options to customers. This approach significantly reduces the time spent in the IVR menu, leading to a better customer experience. This also minimizes the chance the customer will require transfer to a human agent.Figure 2. Selectively changing the IVR menu structure based on customer profileFor use cases with a limited number of menu options, the solution can be achieved directly in the Amazon Connect IVR designer through the use of theCheck Contact Attributesblock. However, this approach can lead to complex and hard to maintain flows for situations where dozens of menu variations are possible. A more scalable solution is to store customer information and menu options in DynamoDB and build the menu dynamically by using a series of Lambda functions (Figure 3).Consider a customer with the following information stored in a database: phone number, name, and active insurance policies. A dynamic menu implementation will authenticate the user based on the phone number, retrieve the policy information from the database, and build the menu options.The first Lambda function retrieves the customer’s active policies and builds the personalized greeting and menu selection prompt. The second Lambda function maps the customer’s menu selection to the correct menu path. This is required since the menu is dynamic and the items and ordering are different for different customers. This approach also allows administrators to add or change insurance types and their details, directly in the database, without the need to update the IVR structure. This can be useful when maintaining IVR flows for dozens of products or services.Figure 3 – IVR flow leveraging dynamically generated menu options.WalkthroughSample code for this solution is provided in thisGitHub repo. The code is packaged as a CDK application, allowing the solution to be deployed in minutes. The deployment tasks are as follows:Deploy the CDK app.Update Amazon Connect instance settings.Import the demo flow and data.PrerequisitesFor this walkthrough, you need the following prerequisites:AnAWS account.AWS CLI access to the AWS account where you would like to deploy your solution.An Amazon Connect instance. If you do not have an Amazon Connect instance, you can deploy one and claim a phone number withSet up your Amazon Connect instance.Deploy the CDK applicationThe resources required for this demo are packaged as a CDK app. Before proceeding, confirm you haveCLI accessto the AWS account where you would like to deploy your solution.Open a terminal window and clone the GitHub repository in a directory of your choice:git clone git@github.com:aws-samples/amazon-connect-dynamic-ivr-menus.gitNavigate to the cdk-app directory and follow the deployment instructions. The default region is usually us-east-1. If you would like to deploy in another Region, you can run:export AWS_DEFAULT_REGION=eu-central-1Update Amazon Connect instance settingsYou need to update your Amazon Connect instance settings to implement the Lambda functions created by the CDK app.Log into the AWS console.Navigate toServices>Amazon Connect. Select yourAmazon Connect instance.SelectContact Flows.Scroll down to the Lambda section and addgetCustomerDetails*andselectionFulfi lment*functions. If the Lambda functions are not listed, return to theDeploy the CDK applicationsection and verify there are no deployment errors.Select +Add Lambda function.Import the demo flowDownload theDemoMenuAmazon Connect flow from the flow_archive section of the sample code repository.Log in to the Amazon Connect console. You can find the Amazon Connect access url for your instance in the AWS Console, under Services >Amazon Connect> (Your Instance Name). The access url will have the following format: https://<your_instance_name>.awsapps.com/connect/loginCreate a new contact flow by selecting ‘Contact Flows’ from the left side menu and then selectCreate New Contact Flow.Select ‘Import Flow(beta)’ from the upper right corner menu and select theDemoMenufile downloaded at step 1.Click on the first ‘Invoke Lambda’ block, and verify thegetCustomerDetails*Lambda is selected.Select the secondInvoke Lambdablock, and verify theselectionFulfilment*’Lambda is selected.SelectPublish.Associate the new flow with your claimed phone number (phone numbers are listed in the left side menu).Update the demo data and testFor the demo to work and recognize your phone number, you will need to enter your phone number into the democustomers table.Navigate to the AWS console and selectDynamoDB.From the left hand side menu selectTables, open theCdkAppStack-policiesDb*table, and navigate to theItemstab. If the table is empty, verify you started the populateDBLamba, as mentioned in the CDK deployment instructions.Select one of the customers in the table, then select Actions > Duplicate. In the new item, enter your phone number (in international format).SelectSave.Dial your claimed Connect number. You should hear the menu options based on your database table entry.Clean upYou can remove all resources provisioned for the CDK app by navigating to the cdk-app directory and running the following command:cdk destroyThis will not remove your Amazon Connect instance. You can remove it by navigating to theAWS console>Services>Amazon Connect. Find your Connect instance and selectRemove.ConclusionIn this post we showed you how a dynamic IVR menu can be implemented in Amazon Connect. Using a dynamic menu can significantly reduce call durations by helping customers reach relevant content faster in the IVR system, which often leads to improved customer satisfaction. Furthermore, this approach to building IVR menus provides call center administrators with a way to manage menus with dozens or hundreds of branches directly in a backend database, as well as add or update menu options.Field Notes provides hands-on technical guidance from AWS Solutions Architects, consultants, and technical account managers, based on their experiences in the field solving real-world business problems for customers.Accelerating Innovation with the Accenture AWS Business Group (AABG)By working with the Accenture AWS Business Group (AABG), you can learn from the resources, technical expertise, and industry knowledge of two leading innovators, helping you accelerate the pace of innovation to deliver disruptive products and services. The AABG helps customers ideate and innovate cloud solutions with customers through rapid prototype development.Connect with our team at accentureaws@amazon.com to learn how to use machine learning in your products and services.Zdenko EstokZdenko Estok works as a Cloud Architect and DevOps engineer at Accenture. He works with AABG to develop and implement innovative cloud solutions, and specializes in Infrastructure as Code and Cloud Security. Zdenko likes to bike to the office and enjoys pleasant walks in nature.TAGS:Field NotesMarius CealeraMarius Cealera is a senior partner solutions architect at AWS. He works closely with the Accenture AWS Business Group (AABG) to develop and implement innovative cloud solutions. When not working, he enjoys being with his family, biking and trekking in and around Luxembourg.
This post was co-written by Marius Cealera, Senior Partner Solutions Architect at AWS, and Zdenko Estok, Cloud Architect and DevOps Engineer at Accenture.  Modern interactive voice response (IVR) systems help customers find answers to their questions through a series of menus, usually relying on the customer to filter and select the right options. Adding more […]
Marius Cealera
Amazon Connect Architecture AWS Lambda Technical How-to