Skip to main content

Amazon Web Services

Advanced Lex: Collecting Alphanumeric Part Numbers

Istock 843015650

Companies with service technicians can leverage an advanced Lex technique to allow their IVR to accept alphanumeric part numbers without complicated dialing schemes. An IVR that can accept part numbers, invoice numbers, and various other complex identifiers easily and accurately can speed up processing and increase customer satisfaction.

Numeric identifiers are easy for Lex. The caller can speak the numbers or use the dial-pad. Alphabetic characters, however, require a different approach, one which we’ll describe here. Lex can struggle with accuracy when interpreting spoken letters of the alphabet. The technique below significantly improves accuracy, and although it won’t handle all use cases, it does handle the more common ones.

Readers should have experience with the Lex console and zip files before attempting this technique. For those who don’t, a good starting point is here: What is Amazon Lex

For this example, we’ll assume our Contact Flow should collect a part number that consists of a prefix of 3 alphabetic characters followed by a suffix of 6 numeric characters. We’ll say there are three possible prefixes: DRL, CTR, and RTR. Most companies will have more than three prefixes. The technique shown here will support up to 10,000 prefixes.

We’ll cover just the alphabetic bot in this blog post, since collecting numeric digits is covered in the introductory material linked above.

We’ll create a new Lex bot with a single intent called “AlphaIntent” that’s going to collect slot value “PartNumberAlpha.”  Here’s what that looks like in the Lex console:




This intent will require a custom slot, and that is where we’ll employ some advanced techniques. First, we’ll create a new custom slot type called “PartAlpha” and set it up as follows. Note that “Restrict to Slot values and Synonyms” is selected, and “dummy” has been added as slot value:

Amazon Web Services - Avoid Contact Center Outages: Plan Your Upgrade to Amazon Connect
Avoid Contact Center Outages: Plan Your Upgrade to Amazon Connect

Learn the six most common pitfalls when upgrading your contact center, and how Amazon Connect can help you avoid them.

Get the Guide


We’ll click “Add slot to intent” so we can use this slot in our Lex bot. Now we can configure the bot’s single slot like this:


Next, we’ll go back to the main Lex console and click on “Slot Types.”  Then we can download the json representation of the slot by selecting the “PartAlpha” slot and choosing “Export” from the “Actions” drop-down. Extract the json file from the zip file and put it in a text editor. You should see something like this:


We can replace line 13 to create the three required slot values – DRL, CTR, and RTR:



Note that each letter in a prefix is separated by a period and a space, and also note the commas on lines 14 and 17. Once we have made these updates, we can zip up the file and use the Lex console to import this updated slot definition, replacing the existing slot definition.

This change should cause a significant jump in Lex’s accuracy, but one other setting may influence the effectiveness of this technique. In the Settings tab for the Lex bot, set the Advanced Options to “No.” Doing this usually produces the best results, but you may want to experiment with the “Yes” option as well:


A drawback to this approach is that updating Lex becomes a manual process. If your organization regularly adds new prefixes, then keeping Lex updated can pose challenges. One approach is to update Lex programmatically whenever a new prefix is added. You can find a Lex API call for that here:

If you’re interested in Lex and speech recognition and need some guidance on maximizing your CRM or contact center’s efficiency, we can help. At Perficient, we are an APN Advanced Consulting Partner for Amazon Connect which gives us a unique set of skills to accelerate your cloud, agent, and customer experience.

Perficient takes pride in our personal approach to the customer journey where we help enterprise clients transform and modernize their contact center and CRM experience with platforms like Amazon Connect, Service.

For more information on how Perficient can help you get the most out of Amazon Lex, please contact us here.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Warren Spencer

Warren Spencer is a contact center developer for Perficient, with 40 years of experience across various industries, including manufacturing, media, and government. He has worked in both the US and Canada and collaborated with global teams.

More from this Author

Follow Us