Automate the customer service experience for flight reservations using Amazon Lex

As air travel starts to pick up in many parts of the world, digitization continues to transform the aviation industry. Airlines are working to reduce the number of touchpoints at the airport. Best practices have been implemented to minimize the number of physical interactions between employees and travelers. As a result, customer service is undergoing an accelerated transformation as airlines strive to provide a smooth and seamless experience. Customers contact airline customer service for several reasons, such as making a reservation, querying flight status, tracking baggage, or managing frequent flyer membership. Airlines want to deliver a customer-centric experience that gives passengers a choice on how they engage to ensure high customer satisfaction.

In this post, we review how you can use the pre-built solutions in Amazon Lex to automate the airline customer service experience for flight reservations and deliver a faster, more connected, omnichannel experience.

Solution overview

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 Travel offers pre-built solutions so you can quickly enable conversational experiences for airline customers and increase customer satisfaction. The pre-built bots are configured with intents, sample utterances, and slot types for airline services use cases, and are integrated with Amazon Connect contact flows.

Let’s review a sample conversation of booking a flight as we cover the different components of the pre-built solution:

Agent: You’ve reached reservations. How can I help you today?

Caller: I want to book a flight

Agent: I see you have a frequent flyer account with us. Can you confirm the frequent flyer ID?

Caller: Yes, it’s 12345

Agent: Thank you. And for verification, can I get the last four digits of the credit card on file?

Caller: 1234

Agent: Got it. Let me get some information about your trip. Is this reservation for a one-way trip or a round trip?

Caller: One way

Agent: Got it. What’s the departure city?

Caller: Dallas

Agent: Dallas. Ok. And what’s your destination?

Caller: New York

Agent: Got it. What date would you like to take the flight?

Caller: December 1st

Agent: Got it. What’s your preferred time of departure?

Caller: 5 PM

Agent: Ok. I have flight number A123 departing at 5:30 PM at $200. Should I go ahead and book it?

Caller: Yes

Agent: Can I use the card on file ending in 1234 to make the reservation?

Caller: Yes

Agent: Great. I have you on the A123 to New York departing from Dallas on December 1 at 5:30 PM. Your confirmation code is 123.

Caller: Thank you.

In this sample conversation, the caller wants to book a flight. The agent gathers details about the trip, such as departure city, destination city, number of travelers, and the preferred departure time. After collecting the details, the agent looks for available flights, presents best options, and books the flight.

The AirlinesServicesBot contains intents for common customer service activities, such as booking a flight, checking flight status, getting reservation details, changing a flight reservation, and canceling a flight reservation. It includes the following intents:

  • BookAFlight – Captures trip and passenger information, and helps in booking a flight reservation
  • GetFlightStatus – Captures flight details and provides the current status of the flight
  • GetReservationDetails – Captures trip or passenger information and provides reservation details to the caller
  • ChangeFlightReservation – Captures trip or passenger information and helps with changing the flight reservation
  • CancelFlightReservation – Captures trip or passenger information and helps with canceling the flight reservation
  • GetFlightReservationReceipt – Captures trip or passenger information and provides the flight reservation receipt
  • EndConversation – Ends the conversation based on user input, such as “Thanks, I am done”
  • Fallback – Is invoked when the input doesn’t 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 being run. Integration with Amazon Kendra provides the ability to answer natural language questions during the conversation.

Solution architecture

Let’s review the overall architecture for the solution (see the following diagram):

  • We use an Amazon Lex bot to authenticate the caller, perform transactions (for example, cancel a flight booking), or provide the caller with the requested information (for example, check flight status).
  • We use Lambda to simulate access to backend systems and run the business logic required for performing transactions. For this post, the data we use is stored in an Amazon DynamoDB
  • To answer any user questions, we configure the Amazon Kendra search index so the bot can look up the information and provide a response.
  • You can deploy the conversational experience on an Amazon Connect instance or integrate it with your website.

We include an AWS CloudFormation stack for you that contains all 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 on the Amazon Connect channel.

Prerequisites

You should have the following prerequisites 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:

  1. Choose Launch Stack to launch a CloudFormation stack in the Region of your choice:

  1. For Stack name, enter a name for your stack. This post uses the name airline-bot-solution.

  1. In the Parameters section, enter names for the Amazon Lex bots, DynamoDB table, and Amazon Connect contact flow.

  1. Review the IAM resource creation and choose Create stack.

After a few minutes, your stack should be complete. The core resources are as follows:

  • Amazon Lex botAirlinesBot
  • Lambda functionAirlinesBusinessLogic
  • DynamoDB tableairlines_table
  • Amazon Connect contact flowAirlinesContactFlow
  • IAM rolesLexRole, LexImportRole, LambdaRole, and ConnectRole
  1. If you provided an Amazon Connect ARN during stack creation, navigate to the Amazon Connect dashboard and, on the Routing menu in the navigation pane, choose Phone numbers.

  1. Associate a phone number with the airline services contact flow.

After 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 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.

Airline services: Key capabilities

Let’s review some of the features offered by the pre-built solution, such as handling incomplete date information, interpreting phrases as numbers, and contact center flows.

Handle incomplete date information

Customers responding to date-related questions such as “When did you cancel the reservation?” may omit the year (for example, “on June 25th”) or even the date (“on Monday”) in their responses. Because the year isn’t specified by default, the bot interprets the response as a future date. Similarly, in the second example, the response is interpreted to be a day in the following week. The pre-built solution resolves such incomplete (or underspecified) dates to a date in the past, based on the business logic for the transaction. In addition, an implicit confirmation prompt is used to let the caller know about the interpreted date. The following code shows how an incomplete date is interpreted:

def resolve_underspecified_date_to_past(flight_booking_date):
    flight_booking_date = datetime.strptime(
        flight_booking_date, '%Y-%m-%d').date()
    today = date.today()
    if flight_booking_date <= today:
        return flight_booking_date
    else:
        number_of_days_in_future = (flight_booking_date - today).days
        if number_of_days_in_future > 7:
            return flight_booking_date.replace(year=flight_booking_date.year-1)
        else:
            return flight_booking_date-timedelta(days=7)

Interpret phrases as numbers

Caller responses to questions attempting to collect a number (for example, “How many people traveling?”) may contain phrases describing the count (for example, “my wife and I”) instead of a more explicit answer (“two”). The pre-built bots are configured to handle such descriptive answers by taking a two-step approach to capturing slot values.

The configuration contains two slots: one of a custom slot type to understand phrases, and an optional slot of the built-in slot type AMAZON.Number to capture a number. In the first step, the bot attempts to resolve using the phrases, which contain synonyms for each number (for example, “my wife and I” maps to “2”). If the input isn’t interpreted with the phrases, the bot attempts again with a guided prompt (“How many travelers? For example, you can say 3 travelers.”).

The following screenshot shows values for the NumberofTravellers custom slot type.

The following screenshot shows two slots to capture one value.

The following Lambda function code interprets conversational phrases as numbers:

number_of_travellers_in_words = dialog.get_slot(
        'NumberOfTravellersInWords', intent, preference='interpretedValue')
number_of_travellers = dialog.get_slot(
        'NumberOfTravellers', intent, preference='interpretedValue')

if departure_date and not number_of_travellers_in_words:
    previous_slot_to_elicit = dialog.get_previous_slot_to_elicit(
        intent_request)
    if previous_slot_to_elicit == 'NumberOfTravellersInWords':
        prompt = prompts.get('NumberOfTravellers')
        return dialog.elicit_slot(
            'NumberOfTravellers', active_contexts, 
            session_attributes, intent,
            [{'contentType': 'PlainText', 'content': prompt}])
    else:
        prompt = prompts.get('NumberOfTravellersInWords')
        return dialog.elicit_slot(
                'NumberOfTravellersInWords', active_contexts, 
                session_attributes, intent,
                [{'contentType': 'PlainText', 'content': prompt}])


if number_of_travellers or number_of_travellers_in_words 
        and not preferred_departure_time:
    if not number_of_travellers:
        number_of_travellers = number_of_travellers_in_words
        prompt = prompts.get(
            'PreferredDepartureTime')
        return dialog.elicit_slot(
            'PreferredDepartureTime', active_contexts, 
            session_attributes, intent,
            [{'contentType': 'PlainText', 'content': prompt}])

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 telephone number that they called. The contact flow uses a Get customer input block to invoke the Amazon Lex bot. The following diagram illustrates the airline contact flow.

Clean up

To avoid incurring any charges in the future, delete all the resources created:

  • Amazon Lex bots
  • Lambda functions
  • DynamoDB table
  • Amazon Connect contact flow
  • IAM roles

Conclusion

Amazon Lex for Travel offers pre-built solutions that you can use to expedite delivery of seamless connected experiences and enable a quick resolution of customer requests. In this post, we reviewed a solution for airline customers to automate tasks such as booking a flight, retrieving flight details, and updating a reservation. 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. By building on AWS, leading travel companies are able to control costs and respond quickly to changing customer needs. Try the pre-built airline services 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.

View Original Source (aws.amazon.com) Here.

Leave a Reply

Your email address will not be published. Required fields are marked *

Shared by: AWS Machine Learning

Tags: