This post walks you through a few new features that make it simple to design a conversational flow entirely within Amazon Lex that adheres to best practices for IVR design related to retry prompting. We also cover how to configure a DTMF-only prompt as well as other attributes like timeouts and barge-in.
When designing an IVR solution, it’s best practice to provide an initial prompt that is short and to the point in order to allow a customer to get through the voice interaction quickly. If the system doesn’t understand, it needs to provide a more detailed prompt to guide the user to provide the required information. Should that fail, it’s best practice to fall back to DTMF, and ask the caller to enter the information using their dial pad.
Sometimes, we may also want to define a slot value as voice or DTMF only in order to provide more control over how the system accepts input.
Amazon Lex now lets you set session attributes to control voice and DTMF input modes. You can control voice and DTMF configuration for each slot separately for the initial prompt and each retry prompt using the new advance retry settings. There is also a new setting: Play the messages in order. This sets the message variations for a slot to play in the order they have been entered instead of randomly.
Solution overview
The following short video provides an overview of the concepts covered in this post.
To demonstrate these new features, we deploy a new Amazon Lex bot starting with the BookTrip example bot. We modify the configurations for capturing the CheckinDate
slot value. We then integrate the bot into an Amazon Connect contact flow for testing.
Prerequisites
To implement this solution, you need the following prerequisites:
- An AWS account with permission to create Amazon Lex bots
- An Amazon Connect instance and permissions to create new contact flows and add new Amazon Lex bots
Create an Amazon Lex bot
To start building your bot, complete the following steps:
- On the Amazon Lex console, choose Bots in the navigation pane.
- Choose Create bot.
- For Creation method, select Start with an example.
- For Example bot, choose BookTrip.
- For Bot name, enter a name.
- For Description, enter an optional description.
- For IAM permissions¸ select Create a role with basic Amazon Lex permissions.
- For Children’s Online Privacy Protection Act, select No.
- Choose Next.
- For Voice interaction, choose a voice (for this post, we choose Matthew).
- Choose Done to create the bot.
You can now see the page with the details for theBookHotel
intent.
- Choose Save intent and then choose Visual builder to get a better overview of the conversational design of this intent.You’re presented with a drag and drop editor where you can easily see the progression of the conversation as slots are collected to fulfill the
BookHotel
intent.
- Choose the edit icon for the
CheckInDate
block.
- Choose the gear icon next to Slot prompt.
This opens up additional options for your slot prompts. - Select Play the messages in order.
This sets the prompt variations we’re about to configure to be played in the order they have been defined. This is very useful because it allows us to specify different prompts for the initial utterance and our first and second retry.
Now you can specify the prompts to use when eliciting this slot. - Add two more variations to be used as the first and second retry prompt:
- Choose Configure advanced retry settings.
Here you can configure the number of retries, if audio or DTMF should be enabled for each retry, as well as configurations for timeouts and the characters to use for Deletion and End when using DTMF. - Leave these settings unchanged and choose Confirm.
- Choose Save intent and then choose Build to build the bot.
Integrate the bot with an Amazon Connect contact flow
You can use an existing Amazon Connect instance, or create a new instance. To integrate the Amazon Lex bot, complete the following steps:
- Add the bot to your Amazon Connect instance to allow you to use it in contact flows.
- Create a new contact flow.
- Add a Get customer input block.
The Play prompt block is optional.
- Add a greeting prompt to be played using text-to-speech. For example, “Welcome to Octank travel and hospitality. How can we help you today?”
- Select the Amazon Lex bot that we created earlier.
- For Alias, choose TestBotAlias.
You should only use the TestBotAlias alias for testing; Amazon Lex V2 limits the number of runtime requests that you can make to the alias.If the bot doesn’t appear on the drop-down menu, you haven’t added it properly to your instance of Amazon Connect. Go back and review that step in the instructions.
- Claim a new phone number or use an existing one and point it to the new contact flow.
- Call in and test the bot:
Welcome to Octank travel and hospitality. How can we help you today?
I want to book a hotel.What city will you be staying in?
New YorkWhat day do you want to check in?
Hedgehog. (You can say anything here that is not interpreted as a date.)What day do you want to check in? You can say things like tomorrow, Next Sunday, or November 13th.
Hedgehog.Please enter the day you want to check in using four-digit year, two-digit-month, and two-digit day.
Sunday. (This will be transformed to the corresponding date. Even though the prompt asked for DTMF, voice is still enabled. If you want to disable voice for this specific retry attempt, this can be done in the advanced retry settings of the bot.)How many nights will you be staying?
Four.What type of room would you like, queen, king, or deluxe?
King.Okay, I have you down for a four-night stay in New York starting {CheckInDate}. Shall I book the reservation?
Yes
Notice how the three slot prompts were played in order.
Add session attributes
You can now add session attributes that are sent to the Amazon Lex bot.
- Add the Get customer input block and add the following attribute under Session attributes.
- Set
x-amz-lex:allow-audio-input:BookHotel:CheckInDate
to False.
- Save and publish the contact flow and call in again.Notice how you can’t speak a date when asked for a check-in date. Entering the date using DTMF (2022 11 22) will still work.
- Set
x-amz-lex:allow-audio-input:BookHotel:CheckInDate
to True (or just remove it, since the bot is configured to allow voice per default) and setx-amz-lex:allow-interrupt:*:*
to False.
- Save and publish the contact flow.
You’re now able to speak the date, but you can’t interrupt the prompt that is asking for the date.
For a list of these and other attributes that you can use to disable DTMF input or modify the timeouts for voice and DTMF, refer to Configuring timeouts for capturing user input.
You can also set session attributes in the Get customer input block using external or user-defined attributes. This makes it possible to store the configuration for your Amazon Lex bots externally, and fetch them using an AWS Lambda function. You can also update these attributes based on business rules. This would, for example, allow you to let a customer opt-in to setting all interactions to DTMF only if they’re calling from a noisy environment.
Clean up
When you’re done using this solution, delete the Amazon Lex bot and release the phone number if you claimed a new one.
Conclusion
These recently released features make it easier to design a conversational flow entirely within Amazon Lex that adheres to best practices for IVR design related to retry prompts. These new attributes also make it possible to define the behavior of an Amazon Lex bot through configuration, allowing changes to be made without updating and redeploying contact flows.
Try out these new features to see how they can provide a better customer experience in your contact center!
About the author
Thomas Rindfuss is a Sr. Solutions Architect on the Amazon Lex team. He invents, develops, prototypes, and evangelizes new technical features and solutions for Language AI services that improves the customer experience and eases adoption.