
Retailers want to stay engaged with their customers as they move seamlessly between digital channels and physical storefronts. By delivering personalized and consistent experiences across a range of retail touchpoints, companies can drive brand loyalty. Customers contact retailers’ customer support for reasons such as checking order status, updating shipping preferences, redeeming loyalty points, managing refunds, and finding a physical store. Product recommendations during these interactions are important towards optimizing operations and increasing conversions. Contextual and customized conversations help build relationships with customers and drive repeat business, reduce churn, and increase customer lifetime value.
In this post, we review how you can use a pre-built solution with Amazon Lex to deliver rich customer service experiences for order management, such as getting order status, tracking a package, and canceling or modifying an order.
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, to enable you to build applications with highly engaging user experiences and lifelike conversational interactions. Amazon Lex for retail offers pre-built solutions that help you enhance brand loyalty on an omnichannel customer journey. The pre-built bots are configured with intents, sample utterances, and slot types for retail order management use cases and are integrated with Amazon Connect contact flows.
Let us review a few sample conversations as we cover the different components of the order status pre-built solution:
In the following sample conversation, the caller wants to check the order status. The agent gathers and validates the order ID. Using this information, the agent looks up the order status and updates the caller.
Agent: Thank you for calling Acme. How can I help you today?
Caller: I want to check my order status
Agent: Sure, I can help you with that. Please say or enter the 13-digit order number.
Caller: 1234 56789 1234
Agent: To confirm, I have your order number as 1234 56789 1234. Is that correct?
Caller: Yes
Agent: Ok. Give me a moment. Your order has been shipped. Do you want to know the delivery details?
Caller: Yes
Agent: Sure. Give me a moment. Your package has arrived at the final distribution facility, and it will be delivered on 11/20/2021. Caller: Thank you.
In the following sample conversation, the caller wants to reschedule the order delivery. The agent captures the order ID and verifies the status of the order to determine eligibility for rescheduling. Next, the agent reschedules the delivery to the requested date.
Agent: Thank you for calling Acme. How can I help you today?
Caller: I want to reschedule my delivery
Agent: Sure. I can help with that. Please say or enter the 13-digit order number.
Caller: 1234 56789 1234
Agent: I have your order number as 1234 56789 1234. Is that correct?
Caller: Yes
Agent: Got it. Your order is still being processed, so it can be rescheduled. Can you tell me the date you want the order delivered on?
Caller: November 20th
Agent: November 20, 2021. For verification, can I have the zip code of your billing address?
Caller: 12345
Agent: Thank you. Your delivery has been rescheduled. We will deliver your order on the new scheduled date of Nov 20th 2021. Anything else I can help you with?
The RetailOrderManagementBot contains intents for common order management activities such as getting order status, tracking a package, canceling or modifying an order, returning an item, and rescheduling the delivery. It includes the following intents:
The bot definition includes a complete dialog along with the prompts to manage the conversation. Each bot also integrates with an AWS Lambda function that contains code to simulate business logic execution. Integration with Amazon Kendra provides the ability to answer natural language questions during the conversation.
Let’s review the overall architecture for the solution (see the following diagram).
We include a template that creates an AWS CloudFormation stack for you containing 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 retail order management on the Amazon Connect channel.
You should have the following pre-requisites before we deploy the solution
To deploy this solution, complete the following steps:




You can use sample data to test the bot. If you used an Amazon Connect instance for deployment, you can call the Amazon Connect phone number and interact with the bot. You can also test the solution directly on the Amazon Lex V2 console using voice or text. As you engage with the bot you can see the DynamoDB table get updated 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 additional backend systems.
Let’s review some of the features offered by the pre-built solution to provide a seamless customer experience to the caller.
Information collected at the beginning of the customer service call may be useful later again in the conversation. For example, a caller may start off with order status and follow up with a request to expedite shipping. The pre-built bots persist the order number using session attributes so that the order number can be reused later in the call to update delivery. The agent can then confirm the order number (“I have your order number as 1234567891234. Can I use this for your reschedule request?”) for the update.
The following code is for persisting session attributes:
previous_intent = dialog.get_session_attribute(intent_request, ‘previous_intent’) if previous_intent == ‘GetOrderStatus’: if order_number: dialog.set_session_attribute(intent_request, ‘order_number’, order_number) session_attributes = dialog.get_session_attributes(intent_request) order_number_from_session = dialog.get_session_attribute( intent_request, ‘order_number’) if order_number_from_session: dialog.set_slot(‘OrderNumber’, order_number_from_session, intent) order_number = order_number_from_session if order_number and not order_number_confirmation: previous_slot_to_elicit = dialog.get_previous_slot_to_elicit( intent_request) if previous_slot_to_elicit == ‘OrderNumberConfirmation’: if intent[‘confirmationState’] == ‘Confirmed’: dialog.set_slot(‘OrderNumberConfirmation’, ‘yes’, intent) order_number_confirmation = ‘yes’ elif intent[‘confirmationState’] == ‘Denied’: dialog.set_slot(‘OrderNumberConfirmation’, None, intent) prompt = prompts.get(‘OrderNumber1’) return dialog.elicit_slot( ‘OrderNumber’, active_contexts, session_attributes, intent, [{‘contentType’: ‘PlainText’, ‘content’: prompt}]) elif intent[‘confirmationState’] == ‘None’: prompt = prompts.get( ‘OrderNumberConfirmation1’, order_number=order_number) return dialog.confirm_intent( active_contexts, session_attributes, intent, [{‘contentType’: ‘SSML’, ‘content’: prompt}], previous_dialog_action_type=’ElicitSlot’, previous_slot_to_elicit=’OrderNumberConfirmation’) else: prompt = prompts.get( ‘OrderNumberConfirmation’, order_number=order_number) return dialog.confirm_intent( active_contexts, session_attributes, intent, [{‘contentType’: ‘SSML’, ‘content’: prompt}], previous_dialog_action_type=’ElicitSlot’, previous_slot_to_elicit=’OrderNumberConfirmation’)
In response to open-ended questions, customers may use phrases to provide an answer. For example, when applying for a refund, callers might provide various reasons (for example, “product damaged”, “ordered by mistake”, “wrong size”) that have to be further interpreted before business logic can be executed. The wide range of possible reasons can make it challenging to interpret the exact reason for the return. The pre-built solution uses synonyms to map the input to a list of possible reasons. For the dialog strategy, the bot initially uses a basic prompt (“Please tell me the reason for the return) and then follows with a more a prescriptive prompt (“Sorry, I didn’t follow that. Can you please share the reason for the return? You can say something like ‘not needed, ‘ordered by mistake, or ‘product damaged”).
The following screenshot shows the slot definition and the associated dialog strategy:
if not order_return_reason and previous_slot_to_elicit == ‘OrderReturnReason’: prompt = prompts.get(‘re_elicit_order_return_reason’) return dialog.elicit_slot( ‘OrderReturnReason’, active_context, session_attributes, intent, [{‘contentType’: ‘PlainText’, ‘content’: prompt}] )
The pre-built solution offers an intent that can handle the ending of the conversation. After a query resolution, customers may want to end the conversation by saying something like “Thank you”, “I am done” or “Bye”. The intent recognizes these phrases and ends the call with the closing message “Thank you. Have a great day!”
You can deploy the pre-built solution as part of Amazon Connect contact flows. When customers call into your contact center, the contact flow to which they are sent is the one assigned to the phone number that they called. The contact flow uses a Get customer input block to invoke the Amazon Lex bot. The following diagram shows the contact flow.
To avoid incurring any charges in the future, delete all the resources created.
In this post, we reviewed a solution for retail order management for common customer support activities such as retrieving order status, tracking a package, returning an item, and scheduling delivery. 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’s needs. Amazon Lex for retail offers pre-built solutions that you can use to deliver a consistent brand experience, influence customer actions, and increase revenue. Try the pre-built retail solution on Amazon Lex today!

