{"id":1013,"date":"2021-10-12T08:39:29","date_gmt":"2021-10-12T08:39:29","guid":{"rendered":"https:\/\/salarydistribution.com\/machine-learning\/2021\/10\/12\/build-conversational-experiences-for-credit-card-services-using-amazon-lex\/"},"modified":"2021-10-12T08:39:29","modified_gmt":"2021-10-12T08:39:29","slug":"build-conversational-experiences-for-credit-card-services-using-amazon-lex","status":"publish","type":"post","link":"https:\/\/salarydistribution.com\/machine-learning\/2021\/10\/12\/build-conversational-experiences-for-credit-card-services-using-amazon-lex\/","title":{"rendered":"Build conversational experiences for credit card services using Amazon Lex"},"content":{"rendered":"<div id=\"\">\n<p>New trends are shaping the credit card industry as shopping habits have rapidly evolved over the last 18 months. The pandemic has accelerated the move away from cash towards cards. Card issuers are transforming their products to better serve cardmembers through innovations such as contactless payments and mobile wallet. The rapid change in consumer behavior and expectations requires issuers also improve their customer service function as consumers adopt a digital-first experience. Credit card members contact issuers for several reasons such as bill payments, balance transfers, and resetting PINs. They may have queries related to rewards programs or interest rates. Card members expect a personalized and frictionless experience in their customer service interaction.<\/p>\n<p>In this post, we review how you can use <a href=\"https:\/\/aws.amazon.com\/lex\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Lex<\/a>, a service for building conversational interfaces, to automate the customer service experience for common cardholder activities such as activating the card, making payments, and reporting a lost or stolen card.<\/p>\n<h2>Solution overview<\/h2>\n<p>Amazon Lex provides the advanced deep learning functionalities of automatic speech recognition (ASR) for converting speech to text, and natural language understanding (NLU) to recognize the intent of the text. This enables you to build applications with highly engaging user experiences and lifelike conversational interactions. Amazon Lex for financial services offers pre-built solutions so you can enable more conversational experiences, faster. The pre-built bots are configured with intents, sample utterances, and slot types for credit card use cases and are integrated with <a href=\"https:\/\/aws.amazon.com\/connect\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Connect<\/a> contact flows.<\/p>\n<p>Let\u2019s review a sample conversation as we cover the different components of the pre-built solution:<\/p>\n<p>Sample conversation: Credit card payment<\/p>\n<blockquote>\n<p><em>Agent: Welcome to card services. Can you please say or type your 16-digit card number?<\/em><\/p>\n<p><em>Caller:\u00a0<\/em><em>1234 5678 1234 5678<\/em><\/p>\n<p><em>Agent: Okay. And the zipcode on the card?<\/em><\/p>\n<p><em>Caller:\u00a0<\/em><em>76543<\/em><\/p>\n<p><em>Agent: Thank you for being a valued customer. How may I help you?<\/em><\/p>\n<p><em>Caller: I want to make a payment.<\/em><\/p>\n<p><em>Agent: Sure. For verification, please enter the last four digits of the primary card holder\u2019s social security number.<\/em><\/p>\n<p><em>Caller: 6789<\/em><\/p>\n<p><em>Agent: Our records indicate that your last payment transaction was processed using a checking account number ending in 7890. Would you would like to use the same account?<\/em><\/p>\n<p><em>Caller: Yes<\/em><\/p>\n<p><em>Agent: All right. So how much would you like to pay? Your minimum due $125, the current balance of $400, or a different amount?<\/em><\/p>\n<p><em>Caller: Minimum due<\/em><\/p>\n<p><em>Agent: Thank you. You are requesting a payment of $125 towards your credit card account. The funds will be withdrawn as a one-time electronic transfer from your bank account, ending in 7890. Can I go ahead with the payment request?<\/em><\/p>\n<p><em>Caller: Yes<\/em><\/p>\n<p><em>Agent: Can I have the three-digit security code printed on the back of your card?<\/em><\/p>\n<p><em>Caller: 123<\/em><\/p>\n<p><em>Agent: Thank you. Your payment was successful and has a confirmation number 12345678. Let me know if there\u2019s anything else I can help you with.<\/em><\/p>\n<p><em>Caller: No thanks.<\/em><\/p>\n<p><em>Agent: Thank you. Have a great day!<\/em><\/p>\n<\/blockquote>\n<p>In the preceding sample conversations, the agent first collects information (SSN and account ID) to verify the caller\u2019s identity. After the caller is verified, the agent engages to complete the user request (make a payment) by starting a dialog to collect additional information (payment amount). Lastly, the agent performs the task (process payment) and provides a confirmation. The pre-built solution includes bots for authentication and card services that can be deployed on Amazon Lex to automate the conversations.<\/p>\n<p>The\u00a0<code>CardAuthentication<\/code> bot provides dialog to authenticate the caller. It includes the following intents:<\/p>\n<ul>\n<li><strong>Authentication <\/strong>\u2013 The intent collects information such as the caller\u2019s credit card number and zipcode, and verifies these with the details on the account that are stored in a secure database (DynamoDB table).<\/li>\n<li><strong>MissingInfo<\/strong>\u00a0\u2013 The intent is triggered if the caller does not have access to information requested in the authentication intent.<\/li>\n<li><strong>Fallback<\/strong>\u00a0\u2013 The intent is invoked when the input does not match any of the configured intents.<\/li>\n<\/ul>\n<p>The <code>CardServices<\/code> bot contains intents for common cardmember activities such as activating cards, resetting PINs, and reporting a lost or stolen card. It includes the following intents:<\/p>\n<ul>\n<li><strong>ActivateCard <\/strong>\u2013 The intent activates the card after collecting information such as credit card number and security code.<\/li>\n<li><strong>CreditCardBenefits <\/strong>\u2013 The intent provides information about the benefits to card member.<\/li>\n<li><strong>EmailCardPIN <\/strong>\u2013 A follow-up intent so that caller can request delivery of PIN through email.<\/li>\n<li><strong>EndConversation<\/strong><strong>\u00a0<\/strong>\u2013 An intent to end the conversation on caller inputs such as \u201cBye\u201d and \u201cI am done\u201d.<\/li>\n<li><strong>MailCardPIN <\/strong>\u2013 A follow-up intent gated by context so that it is triggered after a the ResetCardPIN intent.<\/li>\n<li><strong>PayCardBill<\/strong><strong>\u00a0\u2013 <\/strong>The intent collects information such as payment amount, security code, and last four of SSN and processes the payment.<\/li>\n<li><strong>Repeat <\/strong>\u2013 An intent based on the built-in capability to repeat the last bot response.<\/li>\n<li><strong>ReportMissingCard <\/strong>\u2013 The intent captures information related to lost or stolen cards by recording details such reason and date.<\/li>\n<li><strong>RequestNewCard<\/strong> \u2013 The intent captures callers request for a new or replacement card.<\/li>\n<li><strong>ResetCardPIN <\/strong>\u2013 The intent helps with resetting the PIN after verifying the security code on the card.<\/li>\n<li><strong>ZipcodeVerificationNewCard <\/strong>\u2013 An intent to capture the zipcode on the card.<\/li>\n<li><strong>Fallback<\/strong>\u00a0\u2013 The intent is invoked when the input does not match any of the configured intents.<\/li>\n<\/ul>\n<p>The bot definition includes a complete dialog along with the prompts to manage the conversation. Each bot also integrates with an <a href=\"https:\/\/aws.amazon.com\/lambda\/\" target=\"_blank\" rel=\"noopener noreferrer\">AWS Lambda<\/a> function that contains code to simulate business logic execution. Integration with <a href=\"https:\/\/aws.amazon.com\/kendra\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Kendra<\/a> provides the ability to answer natural language questions during the conversation.<\/p>\n<h2>Solution architecture<\/h2>\n<p>Let\u2019s review the overall architecture for the solution (see the following diagram).<\/p>\n<ul>\n<li>We use an Amazon Lex bot to first authenticate the caller by verifying information that is stored in a secure database.<\/li>\n<li>We use Lambda to simulate access to backend systems and perform the authentication function. For the purposes of this post the card data used for authentication is stored in a DynamoDB table.<\/li>\n<li>After the caller is authenticated, the control is passed to the main card services bot to perform transactions (for example make payment) or provide caller with requested information (for example \u201cWhat can I redeem rewards for?\u201d We use Lambda to run business logic required for completing transactions.<\/li>\n<li>To answer any user questions, we configure an Amazon Kendra search index so the bot can look up the information and provide a response.<\/li>\n<li>You can deploy the conversational experience on a <a href=\"https:\/\/docs.aws.amazon.com\/connect\/latest\/adminguide\/amazon-connect-instances.html\" target=\"_blank\" rel=\"noopener noreferrer\">Connect instance<\/a> or integrate with your website.<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-29230\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/10\/12\/1-6097-Architecture.jpg\" alt=\"\" width=\"800\" height=\"472\"><\/p>\n<p>We include a template that creates an AWS CloudFormation stack for you containing all of these AWS resources, as well as the required AWS Identity and Access Management (IAM) roles. With these resources in place, you can use the pre-built solution for card services on the Amazon Connect channel.<\/p>\n<h2>Prerequisites<\/h2>\n<p>You should confirm the following pre-requisites before we deploy the solution<\/p>\n<ul>\n<li>An\u00a0<a href=\"https:\/\/signin.aws.amazon.com\/signin?redirect_uri=https%3A%2F%2Fportal.aws.amazon.com%2Fbilling%2Fsignup%2Fresume&amp;client_id=signup\" target=\"_blank\" rel=\"noopener noreferrer\">AWS account<\/a><\/li>\n<li>Access to the following AWS services\n<ul>\n<li>Amazon Lex to create bots<\/li>\n<li>Lambda for the business logic functions<\/li>\n<li>DynamoDB to create the tables<\/li>\n<li>IAM with access to create policies and roles<\/li>\n<li>AWS CloudFormation to run the stack<\/li>\n<\/ul>\n<\/li>\n<li>IAM access and secret key credentials<\/li>\n<li>Optionally, an existing Amazon Connect instance (if you plan to deploy on Amazon Connect)<\/li>\n<\/ul>\n<h2>Deploy the pre-built solution<\/h2>\n<p>To deploy this solution, complete the following steps:<\/p>\n<ol>\n<li>Choose <strong>Launch Stack<\/strong> to launch an AWS CloudFormation stack in the Region of your choice:<\/li>\n<\/ol>\n<p><a href=\"https:\/\/console.aws.amazon.com\/cloudformation\/home?#\/stacks\/quickcreate?templateURL=https:\/\/lex-usecases-templates.s3.amazonaws.com\/Financial_Services_Card_Services.yaml&amp;stackName=card-services-stack\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-16174\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2020\/09\/22\/LaunchStack.jpg\" alt=\"\" width=\"144\" height=\"27\"><\/a><\/p>\n<ol start=\"2\">\n<li>For\u00a0<strong>Stack name<\/strong>, enter a name for your stack. This post uses the name <code>card-services-solution<\/code>:<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-29231\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/10\/12\/2-6097-quick-create.jpg\" alt=\"\" width=\"800\" height=\"425\"><\/p>\n<ol start=\"3\">\n<li>Next, provide the <strong>Parameters<\/strong> for Lex bots, DynamoDB table, and the Connect contact flow.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-29232\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/10\/12\/3-6097-.jpg\" alt=\"\" width=\"800\" height=\"650\"><\/p>\n<ol start=\"4\">\n<li>Lastly, review the IAM resource creation and click on \u2018<strong>Create Stack\u2019<\/strong>. After a few minutes, your stack should be complete. The core resources are listed below:<\/li>\n<\/ol>\n<ul>\n<li>Amazon Lex bots: <code>CardAuthentication<\/code> and <code>CardServices<\/code><\/li>\n<li>Lambda functions: <code>CardAuthenticationFunction<\/code> and <code>CardServicesFunction<\/code><\/li>\n<li>DynamoDB:<code> card_services_table<\/code><\/li>\n<li>Amazon Connect contact flow: <code>CardServicesFlow<\/code><\/li>\n<li>IAM roles: <code>LexRole<\/code>, <code>LexImportRole<\/code>, <code>LambdaRole<\/code>, <code>ConnectRole<\/code><\/li>\n<\/ul>\n<ol start=\"5\">\n<li>If you provided a Connect ARN during stack creation, then navigate to the Amazon Connect dashboard and click on \u2018<strong>Phone numbers\u2019<\/strong> tab.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-29233\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/10\/12\/4-6097-dashboard.jpg\" alt=\"\" width=\"800\" height=\"466\"><\/p>\n<ol start=\"6\">\n<li>Next you will associate a phone number with the card services contact flow. Once the phone number is associated, the solution is ready to be tested.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-29234\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/10\/12\/5-6097-edit-phone.jpg\" alt=\"\" width=\"800\" height=\"350\"><\/p>\n<h2>Test the solution<\/h2>\n<p>You can use <a href=\"https:\/\/lex-usecases-templates.s3.amazonaws.com\/Card_Services_Sample_Data.html\" target=\"_blank\" rel=\"noopener noreferrer\">sample data<\/a> to test the bot. If you used an Amazon Connect instance for deployment, you can call in to the Amazon Connect phone number and interact with the bot. You can also test the solution directly on the <a href=\"https:\/\/console.aws.amazon.com\/lex\/home\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Lex V2 console<\/a> using voice or text. As you engage with the bot you can observe the DynamoDB table update based on the conversation. After you try out the pre-built conversation flows, you can customize the bot add more intents as required and integrate with the backend systems.<\/p>\n<h2>Card services: Key capabilities<\/h2>\n<p>Let\u2019s review some of the core capabilities offered by the pre-built solution across dialog management, natural language search, and contact center flows.<\/p>\n<p><strong>Dialog management: <\/strong>Customer service conversations often include patterns as the caller interacts with the agent. Amazon Lex provides native support for some conversation patterns such as <a href=\"https:\/\/docs.aws.amazon.com\/lexv2\/latest\/dg\/wait-and-continue.html\" target=\"_blank\" rel=\"noopener noreferrer\">Wait and Continue<\/a> when a caller requests the agent to <em>wait<\/em> in a conversation (\u201cCan you hold on a second while I get my credit card?\u201d) and then <em>continue<\/em> the call (\u201cOk let\u2019s go ahead. My credit card number is 1234\u201d). In addition, the pre-built solution offers functionality to handle other conversation patterns such as request disambiguation and input confirmation.<\/p>\n<p>First, let\u2019s review how we can disambiguate user requests such as \u201cI\u2019d like to <em>cancel<\/em>\u201d. It\u2019s not clear from the input if the caller wants to cancel a recent balance transfer, or their auto payment, or the credit card. Agents have to navigate such conversations carefully to elicit the relevant details before performing the appropriate task. The pre-built solution uses <a href=\"https:\/\/docs.aws.amazon.com\/lexv2\/latest\/dg\/using-confidence-scores.html\" target=\"_blank\" rel=\"noopener noreferrer\">intent classification confidence scores<\/a> along with the alternate intent matches surfaced in the API response to disambiguate user requests. In this case, the Lambda function in the fallback intent is configured to respond with a clarification \u201cDo you want to cancel a balance transfer, cancel auto pay, or cancel the card?\u201d If an alternate intent (for example, cancel auto pay) is above a certain threshold confidence score, then the corresponding verbiage (\u201cDid you mean <em>cancel auto pay<\/em>?\u201d) is appended to the clarification prompt. The following is the dialog management code for the disambiguation pattern:<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-python\">disambiguation_prompts = {\n    \"CancelAutoPayment\": \"Did you mean cancel auto pay?\",\n    \"CancelRecentBalanceTransfer\": \"Do you want to cancel a balance transfer?\",\n    \"CancelCreditCard\": \"Do you want to cancel the credit card\"\n    \"DefaultFallback\": \"Some of the things I can help you with are: bill payment, \n        card activation, reporting missing card. Can you please rephrase your request?\"\n}\n\nintent = dialog.get_intent(intent_request)\nactive_contexts = dialog.get_active_contexts(intent_request)\nsession_attributes = dialog.get_session_attributes(intent_request)\n\nif intent['name'] == 'Fallback':\n    prompts = disambiguation_prompts\n\n    interpreted_intents = [\n        {'name':intents_list['intent']['name'], \n         'nluConfidence':intents_list.get('nluConfidence')}\n        for intents_list in intent_request['interpretations']]\n    \n    possible_intents = interpreted_intents[1:]\n\n    default_fallback_message = \n        disambiguation_prompts.get('DefaultFallback')\n    message = default_fallback_message\n    \n    if len(possible_intents) &gt; 0:\n        nearest_intent = possible_intents[0]\n        if nearest_intent.get('nluConfidence') &gt; 0.6:\n            message = \n                disambiguation_prompts.get(nearest_intent['name'])\n\n    return dialog.elicit_intent(\n        active_contexts, session_attributes, intent, \n        [{'contentType': 'PlainText', 'content': message}])\n<\/code><\/pre>\n<\/p><\/div>\n<p>Next, let\u2019s will walk through a conversation pattern that requires confirmation of input. For example, consider a dialog to collect the destination account for a credit balance transfer request. It\u2019s critical to capture the destination account accurately; an agent would typically confirm the destination account (\u201cI have the account ID as 1234567890. <em>Is that correct<\/em>?\u201d) The pre-built solution offers a capability so you can confirm user input for such slots. The Lambda function for the <a href=\"https:\/\/docs.aws.amazon.com\/lexv2\/latest\/dg\/lambda.html#lambda-attach\" target=\"_blank\" rel=\"noopener noreferrer\">dialog codehook<\/a> for the slot is configured to respond with a confirmation (\u201c<em>To make sure I got that right:<\/em> Do you want to initiate the transfer to 1234567890?\u201d). The following is the dialog management code for the slot confirmation pattern:<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-python\">if account_number and not account_number_confirmation:\n    previous_slot_to_elicit = dialog.get_previous_slot_to_elicit(\n                                                        intent_request)\n    if intent['confirmationState'] == 'Confirmed':\n        dialog.set_slot('AccountNumberConfirmation', 'Confirmed', intent)\n        account_number_confirmation = 'Confirmed'\n    elif intent['confirmationState'] == 'Denied':\n        dialog.set_slot('AccountNumberConfirmation', 'Denied', intent)\n        account_number_confirmation = 'Denied'\n    else:\n        dialog.set_slot('AccountNumber', 'others', intent) prompt = \"Okay, Can you\n               give your account number again?\" \n\treturn dialog.elicit_slot(\n            'AccountNumber', active_contexts, session_attributes,\n            intent, [{'contentType': 'PlainText', 'content': prompt}])\n    else:\n        prompt = \"&lt;speak&gt;I have your account number as, \n                    &lt;say-as interpret-as='digits'&gt;\"+str(account_number)+\n                    \"&lt;\/say-as&gt;, Is that correct? &lt;\/speak&gt;\"\n        return dialog.confirm_intent(\n                    active_contexts, session_attributes, intent,\n                    [{'contentType': 'PlainText','content': prompt}],\n                    previous_dialog_action_type='elicit_slot',\n                    previous_slot_to_elicit = 'CheckAuthorization')\n<\/code><\/pre>\n<\/p><\/div>\n<h2>Natural language search<\/h2>\n<p>Callers often ask questions related to the product or service during a customer service call. For example, they may inquire about interest rates (\u201cWhat is the APR applied to my card?\u201d) in a payment call or ask about a rewards program (\u201cCan I apply the rewards points to groceries?\u201d). Amazon Lex natively integrates with Amazon Kendra, an intelligent search service, so you can configure the bot to answer questions in a conversation. You can upload your content to Amazon Simple Storage Service (Amazon S3) bucket and create a search index on Amazon Kendra. You simply define the search index parameters in a <a href=\"https:\/\/docs.aws.amazon.com\/lexv2\/latest\/dg\/built-in-intent-kendra-search.html\" target=\"_blank\" rel=\"noopener noreferrer\">search intent<\/a> as part of the bot definition. The bot queries the Amazon Kendra search index during the interaction if the user input doesn\u2019t match any of the other configured intents. The search query responses are populated with request attributes that the bot can use in its response.<\/p>\n<h2>Contact center flows<\/h2>\n<p>You can deploy the pre-built solution as part of Amazon Connect contact flows. When customers call in to your contact center, the contact flow to which they are sent is the one assigned to the telephone number that they called. The contact flow uses a <a href=\"https:\/\/docs.aws.amazon.com\/connect\/latest\/adminguide\/get-customer-input.html\" target=\"_blank\" rel=\"noopener noreferrer\">customer input block<\/a> to invoke an Amazon Lex bot. The following diagram shows the credit services contact flow in Amazon Connect:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-29235\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/10\/12\/6-6097.jpg\" alt=\"\" width=\"800\" height=\"296\"><\/p>\n<p>The first \u2018<strong>Get customer input\u2019<\/strong> block passes the control to the Authentication bot. You can restrict the number of authentication attempts with the following code:<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-python\">if zip_code = dialog.get_slot('ZipCode', intent)\ncard_number = dialog.get_slot('CardNumber', intent)\n\nnumber_of_attempts = dialog.get_session_attribute(intent_request, 'number_of_attempts') or '0'\nnumber_of_attempts = number_of_attempts + 1\n\n# use session attributes to maintain the number of user attempts\ndialog.set_session_attribute(\n    intent_request, 'number_of_attempts', str(number_of_attempts))\nsession_attributes = dialog.get_session_attributes(intent_request)\n\nif not zip_code or not card_number:\n    return dialog.delegate(active_contexts, session_attributes, intent)\n\nif zip_code and card_number:\n    # authenticate customer\n    customer_id = card_system.get_customer_id(card_number, zip_code)\n    \n    # didn't find customer id\n    if not customer_id:\n        if number_of_attempts &gt;= 3:\n            response \n                =   \"For your security, we are unable to complete your request, \n                    until you are able to provide required information. Bye\"\n            dialog.set_session_attribute(\n                intent_request, 'authentication_status', \n                'UNAUTHENTICATED')\n            return dialog.close(\n                active_contexts, session_attributes, intent, \n                [{'contentType': 'PlainText', 'content': response}])\n        \n        if number_of_attempts == 1:\n            prompt = \"I didn't find a match. Please say or enter your card number. \n                    If you need time to get that information, say, wait a moment.\"\n        elif number_of_attempts == 2:\n            prompt = \"I didn't find a match. Please try one last time. \n                        Say or enter your card number.\"\n            \n        return dialog.elicit_slot(\n            'CardNumber', active_contexts, session_attributes, \n            init_state, \n            [{'contentType': 'PlainText', 'content': prompt}])\n    else:\n        ''' \n          got the customer id\n          store customer authentication details in the session\n        '''\n        intent_request = dialog.set_session_attribute(\n            intent_request, 'authentication_status', 'AUTHENTICATED')\n        dialog.set_session_attribute(\n            intent_request, 'customer_id', customer_id)\n        session_attributes = dialog.get_session_attributes(\n            intent_request)\n        response = \"Thank you for being our customer.\"\n        return dialog.close(\n            active_contexts, session_attributes, intent, \n            [{'contentType': 'PlainText', 'content': response}])\n<\/code><\/pre>\n<\/p><\/div>\n<p>After the authentication, the \u2018<strong>Check contact attributes\u2019<\/strong>\u00a0block verifies the status and transfers the flow to the card services bot only if the contact attribute is set to \u2018Authenticated\u2019. Information captured during verification (such as account ID) passed in the flow through session attributes.<\/p>\n<h2>Cleanup<\/h2>\n<p>To avoid incurring any charges in the future, delete all the resources created.<\/p>\n<ol>\n<li>Amazon Lex bots<\/li>\n<li>Lambda functions<\/li>\n<li>DynamoDB table<\/li>\n<li>Amazon Connect Contact flow<\/li>\n<li>IAM roles<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>Amazon Lex for financial services offers pre-built solutions that you can use to expedite delivery of natural and sophisticated conversational experiences. In this post, we reviewed a solution for a credit card services customers service function for common cardmember activities such as making a payment, activating a card, and resetting a PIN. The pre-built solution provides a ready-to-deploy contact center configuration with Amazon Connect. You can easily extend the solution with additional conversation flows that are specific to your organization\u2019s needs. Building on AWS empowers you to modernize infrastructure, meet rapidly changing customer behaviors and expectations, and drive business growth. Try the pre-built <a href=\"https:\/\/aws.amazon.com\/lex\/financial-services\/?nc=sn&amp;loc=3&amp;dn=1\" target=\"_blank\" rel=\"noopener noreferrer\">financial services solution<\/a> on Amazon Lex today!<\/p>\n<hr>\n<h3>About the Authors<\/h3>\n<p><strong><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-29239 alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/10\/12\/JP-Kommu.jpg\" alt=\"\" width=\"101\" height=\"123\">Jaya Prakash Kommu<\/strong> is a Technology Lead on the Smartbots.ai team. He manages a passionate team of AI engineers building next generation conversational AI interfaces. When not architecting bots, JP enjoys playing football.<\/p>\n<p><strong><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-27294 alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/08\/17\/Sandeep-Srinivasan.jpg\" alt=\"\" width=\"100\" height=\"106\">Sandeep Srinivasan<\/strong> is a Product Manager on the Amazon Lex team. As a keen observer of human behavior, he is passionate about customer experience. He spends his waking hours at the intersection of people, technology, and the future.<\/p>\n<p>       <!-- '\"` -->\n      <\/div>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/aws.amazon.com\/blogs\/machine-learning\/build-conversational-experiences-for-credit-card-services-using-amazon-lex\/<\/p>\n","protected":false},"author":0,"featured_media":1014,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts\/1013"}],"collection":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/comments?post=1013"}],"version-history":[{"count":0,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts\/1013\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/media\/1014"}],"wp:attachment":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/media?parent=1013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/categories?post=1013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/tags?post=1013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}