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?
Agent: Ok. Give me a moment. Your order has been shipped. Do you want to know the delivery details?
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?
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?
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:
GetOrderStatus – This intent captures the order ID and provides the current status of the order.
TrackPackage – This intent captures the order ID and provides the current status of the shipping status.
CancelOrder – This intent captures the order ID and helps with canceling the order.
ReturnItem – This intent captures the order ID and helps with initiating a return of an item, after verifying the order ID.
RescheduleDelivery – This intent captures the order ID and helps with rescheduling the delivery.
EndConversation – This intent ends the conversation based on user input such as “thanks, I am done”.
Fallback – This intent is invoked when the input does not match any of the configured 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 use Amazon Lex bot to authenticate the caller, perform transactions (for example, “reschedule delivery”) or provide the caller with the requested information (for example, “get order status”).
We use AWS Lambda to simulate access to backend systems and to run the business logic required for completing transactions. For the purpose of this blog post, the data used is stored in a DynamoDB table.
To answer any user questions, we configure Amazon Kendra search index so the bot can look up the information and provide a response.
You can deploy the conversational experience on a Connect instance or integrate it with your website.
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
An AWS account
Access to the following AWS services
Amazon Lex to create bots
Lambda for the business logic functions
DynamoDB to create the tables
IAM with access to create policies and roles
AWS CloudFormation to run the stack
IAM access and secret key credentials
Optionally, an existing Amazon Connect instance (if you plan to deploy on Amazon Connect)
Deploy the pre-built solution
To deploy this solution, complete the following steps:
Choose Launch Stack to launch an AWS CloudFormation stack in the Region of your choice:
For Stack name, enter a name for your stack. This post uses the name retail-order-stack, as shown in the following screenshot.
Next, in the Parameters section, enter values for the Amazon Lex bots, DynamoDB table, and Amazon Connect contact flow.
Review the IAM resource creation and click on Create Stack. After a few minutes, your stack should be complete. The core resources are listed below:
Amazon Lex bot: RetailOrderManagementBot
Lambda functions: RetailOrderManagementBusinessLogic
Amazon Connect contact flow: RetailOrderManagementContactFlow
IAM roles: LexRole, LexImportRole, LambdaRole, ConnectRole
If you provided a Connect ARN during stack creation, navigate to the Amazon Connect dashboard and choose Phone numbers on the Routing menu in the navigation pane.
Next, associate a phone number with the retail order management contact flow. Once the phone number is associated, the solution is ready to be tested.
Test the solution
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.
Retail order management: Key Capabilities
Let’s review some of the features offered by the pre-built solution to provide a seamless customer experience to the caller.
Persisting information across requests
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:
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:
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!”
Contact center flows
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.
Amazon Lex bots
Amazon Connect Contact flow
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!
About the Authors
Jaya Prakash Kommu 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.
Sandeep Srinivasan 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.
Read MoreAWS Machine Learning Blog