Blocker 55 · AI

The bot never gets my name right: capturing names, numbers and addresses with Amazon Lex on Amazon Connect

Most voice bots fail on the same few things: a surname, a policy number, a postcode. Amazon Lex V2 has a tool for each of them. The work is choosing the right one for every slot, giving callers a second way to answer, and checking real calls to see what the bot heard.

500phrases is the most an Amazon Lex V2 custom vocabulary can hold, so it is for the words your bot keeps missing, not for every word.Source: AWS, Improving speech recognition with a custom vocabulary

Illustration. The blocker: Sorry, I didn't catch that. Again.. The fix: Right slot type, spelling, keypad.

The blocker

“Please say your account number.” The caller says it. The bot reads back a different number. The caller says it again, slower. The bot asks them to repeat it. On the third try they press zero, and an agent asks for the account number a fourth time.

The same thing happens with surnames that are not common in the bot’s language, with street names, with postcodes, and with callers whose accent the bot handles badly. The bot was meant to save agent time. Instead it adds a minute of frustration to the start of the call, and customers learn to skip it.

The bot is usually not broken. It is set up to listen for everything in the same way, when names, codes and addresses each need different handling.

Why it happens

  • Every slot uses the default settings. An account number is captured as free speech, with no pattern to check it against.
  • Letters sound alike on the phone. “B”, “P” and “T” are easy to confuse on a phone line, and the bot has no way to ask “B as in boy?”
  • The bot has never heard your words. Product names, local place names and brand terms are not in a general speech model.
  • The bot ignores what you already know. The caller’s number matched a customer record, but the bot still guesses the name from scratch.
  • There is no second way to answer. When speech fails, the bot asks the same question the same way until the caller gives up.
  • Nobody listens to the failures. Missed utterances are never reviewed, so the same mistakes repeat for months.

How Amazon Connect solves it

You add an Amazon Lex bot to a flow and call it from the Get customer input block. Each detail the bot collects is a slot. Most fixes happen at the slot level, one detail at a time. If you are still replacing a touch-tone menu, start with conversational self-service and come back to this when callers start giving the bot details.

1. Give each detail the right slot type

Amazon Lex V2 has built-in slot types for common data, including AMAZON.FirstName, AMAZON.LastName, AMAZON.EmailAddress, AMAZON.StreetName, AMAZON.Date and AMAZON.Confirmation. Use them instead of a generic free-text slot.

For account, policy and order numbers, use AMAZON.AlphaNumeric with a regular expression that describes your format, for example three letters and six digits. If the input does not match, Amazon Lex V2 prompts the caller to repeat it, so a misheard digit is caught before it reaches your systems. AWS documents the limits: the regular expression can be up to 300 characters, and a value stored in a slot that uses one can be up to 30 characters. Infinite repeaters such as * and + are not supported.

2. Let callers spell, and say which letter they mean

Spelling styles change how the bot listens for a slot. Spell by letter listens for single letters, which helps with a surname like “Xiulan” that AWS uses as its example. Spell by word accepts “a as in alpha, b as in boy”, which solves the B, P and T problem. For AMAZON.AlphaNumeric and AMAZON.UKPostalCode, the default style already accepts spell by letter.

Two details matter. You set the style at runtime, through the API or a Lambda function, when the bot is eliciting the slot. You can’t turn it on in the console. And spelling styles work for English (US, UK and Australia), German, French and Spanish, on the alphanumeric, email, first name, last name and custom slot types, with UK postal codes in English only. AWS recommends asking in the natural style first, then re-prompting with a spelling style if the value was not captured.

3. Teach the bot your words and your customers’ names

A custom vocabulary tells Amazon Lex V2 about words it does not recognize well, such as product names. Each phrase is 1 to 4 words, with a weight from 0 to 3. The maximum is 500 phrases. AWS advises adding only words the bot is missing, and avoiding short words such as “yes” and “no”. For a custom slot type, you can instead choose Use slot values as custom vocabulary, and AWS suggests keeping that list to 500 values and synonyms or fewer.

Runtime hints go further. When the bot is about to ask for a name, a Lambda function can send the names already on file for this caller, and the bot prefers them over similar-sounding words. AWS’s example is looking up the caller by phone number, then passing first and last name hints. Know the limits: runtime hints are only available in English (US) and English (UK), only for custom slot types and a short list of built-in ones (city, country, first name, last name, state and street name), and only for 8 kHz audio from contact center integrations. You must rebuild the bot and create a new version to use them.

4. Choose the speech model and locale

Each bot locale has a speech model preference. The default is Standard. AWS describes the Neural model as giving better handling of natural speech patterns, accents and background noise, and suggests it when callers have diverse accents or call from noisy places. Test both with your own recordings before you switch.

Pick the locale that matches how your callers speak. Amazon Lex V2 has separate English locales for the US, UK, Australia, India and South Africa, among others. On the Amazon Connect side, the Set voice block must set a language attribute that matches the bot’s locale. If you are not using an en-US voice and don’t set it, the Get customer input block results in an error. Our multilingual service post covers serving several languages.

5. Confirm, re-prompt and offer the keypad

A confirmation prompt reads the values back before the bot acts on them. If the caller says no, you can clear the slot and re-elicit it, rather than starting the whole conversation again.

Make each retry different. With Play messages in order, set in the intent settings, the bot can use up to two variations of the original message across retries. The second attempt can ask the caller to spell. The third can ask for the keypad.

Amazon Lex bots in a flow can capture digits from the keypad, which AWS notes lets customers choose how to enter sensitive details such as account numbers. Session attributes control keypad input: # ends the entry, * clears it, and the bot waits 5 seconds after the last digit by default. You can also turn audio or keypad input off for a slot.

When a slot still is not recognized after the configured number of tries, Amazon Lex V2 invokes the fallback intent. Route that to an agent, and pass along whatever the bot did capture so the caller is not asked again.

6. Measure what the bot heard

Amazon Connect bot analytics reports metrics such as utterance recognition rate for bots called from flows. Automated interaction logs put the full bot transcript and keypad selections on each contact’s details page.

In Amazon Lex V2, utterance statistics show detected and missed utterances, with up to 30 days of data from the ListUtteranceMetrics API. Conversation logs store text in CloudWatch Logs and audio in Amazon S3. AWS suggests using audio logs to build a test set for tuning vocabulary weights. The Test Workbench runs test sets built from real transcriptions against a bot before you deploy it. We cover wider bot metrics in measuring AI agents.

What good looks like

A caller says their policy number. The bot checks it against the format and reads it back. When they say “no”, the bot asks them to spell it with words, and gets it. Their surname is already in the hints from the phone number lookup, so the bot gets it first time. A caller on a noisy line uses the keypad instead. Anyone who still fails reaches an agent who can already see what the bot captured. Each week, the team reviews missed utterances, adds the top problem words to the vocabulary, and reruns the test set before release.

Where to start

  1. List every slot in your voice bots, its type, and how often it is retried or ends in a transfer.
  2. Move account and reference numbers to AMAZON.AlphaNumeric with a regular expression, and names to the built-in name slot types.
  3. Add a second prompt that uses a spelling style and a third that offers the keypad, then a fallback to an agent.
  4. Turn on conversation logs with audio, and build a custom vocabulary from the words the bot misses most.
  5. Build a Test Workbench test set from real calls, compare the Standard and Neural speech models, and rerun it before every release.
High-level architectureCapturing hard-to-hear details in a voice bot
Caller
  • Phone call
  • Keypad
Amazon Connect flow
  • Set voice
  • Get customer input
  • Check contact attributes
  • Agent queue
Amazon Lex V2 bot
  • Built-in slot types
  • Spelling styles
  • Custom vocabulary
  • Runtime hints
  • Confirmation
Your systems
  • Customer records
  • Lambda lookups
Tuning
  • Bot analytics
  • Conversation logs
  • Test Workbench
  • People
  • Amazon Connect
  • AWS services
  • Your systems
  1. A Set voice block sets the language attribute to match the bot's locale. A Get customer input block passes the call to an Amazon Lex V2 bot.
  2. Each detail goes into a slot of the right type, such as AMAZON.AlphaNumeric with a pattern for account numbers, or AMAZON.LastName for surnames.
  3. A custom vocabulary covers product and place names. A Lambda function sends runtime hints with the names already on file for this caller.
  4. If the first answer fails, the bot re-prompts with a spelling style or asks for the keypad. It reads the value back with a confirmation prompt.
  5. After the configured retries the flow routes to an agent with what was captured. Bot analytics, conversation logs and the Test Workbench show what to fix next.
References

Official AWS documentation

Every Amazon Connect capability in this post links to AWS’s own documentation, so you can check the details for your Region and account.

  1. Built-in slot typesdocs.aws.amazon.com
  2. AMAZON.AlphaNumericdocs.aws.amazon.com
  3. Capturing slot values with spelling styles during the conversationdocs.aws.amazon.com
  4. Improving speech recognition with a custom vocabularydocs.aws.amazon.com
  5. Improving recognition of slot values with runtime hints in the conversationdocs.aws.amazon.com
  6. Configuring speech recognition model preferencesdocs.aws.amazon.com
  7. Languages and locales supported by Amazon Lex V2docs.aws.amazon.com
  8. Adding intentsdocs.aws.amazon.com
  9. Confirmationdocs.aws.amazon.com
  10. Re-eliciting slotsdocs.aws.amazon.com
  11. AMAZON.FallbackIntentdocs.aws.amazon.com
  12. Configuring timeouts for capturing user input with a Lex V2 botdocs.aws.amazon.com
  13. Logging conversations with conversation logs in Lex V2docs.aws.amazon.com
  14. Using APIs for analyticsdocs.aws.amazon.com
  15. Evaluating Lex V2 bot performance with the Test Workbenchdocs.aws.amazon.com
  16. Add an Amazon Lex bot to Connect Customerdocs.aws.amazon.com
  17. Flow block in Connect Customer: Get customer inputdocs.aws.amazon.com
  18. Flow block in Connect Customer: Set voicedocs.aws.amazon.com
  19. Evaluate the performance of your conversational AI bot in Connect Customerdocs.aws.amazon.com
  20. Monitor automated interactions (IVR) in Connect Customerdocs.aws.amazon.com
Start here

Tell us what you want to improve.

We will tell you whether a voice agent fits it, what it would take, and what it should return. You will hear back within a week.

  • AWS Advanced Tier Services Partner
  • ISO/IEC 27001 certified
  • SOC 2 Type II
  • MWDBE certified