Skip to main content

Amazon Web Services

How to Embed Amazon Lex into Amazon Connect

Why Use Amazon Lex?

Embedding chat bots and virtual assistants into your applications and contact flows has never been more essential to the customer experience than it is today. Amazon Lex is an Amazon Web Service (AWS) product that provides conversational interfaces powered by the same conversational engine, ASR (automatic speech recognition), and NLU (natural language understanding) as Amazon Alexa. These voice and text interfaces can be easily integrated into any application, providing sophisticated customer service and highly engaging user experience.  

The essential benefit to embedding Amazon Lex bots into Amazon Connect (Amazon’s omnichannel cloud contact center) is to harness the power of Alexa’s ASR and NLU in your contact flows (i.e., IVRs). These technologies are natively built into Amazon Lex, and with a few steps you can easily utilize them in your contact center with minimal time spent.  

Amazon Connect integrated with Amazon Lex can also capture customer input as digits (utilizing their digit-based keypad), adding a dynamic means of gathering customer input while your contact flows execute. This further enhances the customer user experience by allowing customers to choose how they would like to enter sensitive information and is all made possible by embedding Amazon Lex into Amazon Connect. This feature is integrated automatically after adding your Amazon Lex bot into a contact flow and requires no additional configuration on your behalf besides following the steps below.  

In the next section of this blog post, we will deep-dive into Amazon Lex and Amazon Connect, specifically outlining the steps necessary to embed Amazon Lex into an Amazon Connect contact flow, and discuss the basic building blocks of an Amazon Lex bot. 


How to integrate an Amazon Lex bot into a contact flow: Step-by-step guide (Plus a word on code hooks)

To embed your Amazon Lex bot into your Amazon Connect instance, you must first configure a Lex bot. There are three main building blocks pertinent to every Lex Bot: intents, utterances, and slots.  

  • An intent represents an action that the user wants to perform. You can create a bot to support one or multiple intents.  
  • Utterances are written or spoken phrases that precisely define how a user might convey their intent. Amazon’s underlying NLU and ASR will parse these utterances, and then associate them with a pre-configured intent (if it can be recognized).  
  • Slots are basic pieces of information that are needed to fulfill a user’s intent. Slots can be marked required or optional. If a slot is marked as required and the user does not provide this slot, the bot will dynamically respond with a customized message to prompt the user’s utterance.  

In addition to the three main building blocks defined above, there are additional means of customizing your Lex bot using Lambda validation and code hooks. Utilizing these options enhances your bot’s functionality. Validation code hooks allow you to define and integrate core business logic, while fulfillment code hooks allow you to capture confirmed events occurring at the end of a customer interaction.  


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

For example, consider a barista bot that takes and processes coffee orders:  

  • If there are certain items on the menu that are only offered in a particular size (i.e., Cappuccino only offered in small or medium, Americano only offered in large, etc.), then a validation code hook can be used to steer the customer within the bounds of this business logic.  
  • If a customer places a valid order within business rules, a fulfillment code hook can capture their order details and store it in a database (i.e., Dynamo DB) for additional processing.  


If you would like a step-by-step guide on creating an Amazon Lex bot, please refer to the AWS administrator guide found at the following link: (  


Once you have created your Amazon Lex bot and added any code hooks (if desired), the first step to embedding Amazon Lex into Amazon Connect is to add the Lex bot to your Amazon Connect instance. There are two main steps necessary to integrate Amazon Lex into Amazon Connect. The first step is completed at the instance level, and the second step is completed at the contact flow level. 


  • Step 1: Open Amazon Connect inside of your AWS Console. 
  • Step 2: Navigate to the Amazon Connect instance that you wish to integrate with Amazon Lex. 
  • Step 3: Chose Contact Flows in the left-hand side menu. 
  • Step 4: Scroll down to Amazon Lex, select the region of your bot, and choose the bot you wish to integrate. 
  • Step 5: Chose the Alias of your bot (if it exists), then click “Add Amazon Lex Bot.” 

At this point, you’ve successfully integrated Amazon Lex into Amazon Connect at the instance level (nice!). The next step to embedding Amazon Lex into your instance is completed granularly at the contact flow level. This can be done by navigating to a contact flow of your choice and dragging the “Get customer input” widget into your flow which can be found in the “Interact” widget section. 

  • Step 6: Drag the “Get customer input” widget onto the canvas and connect it to the “entry point” block inside the flow. 
  • Step 7: Click on the “Get customer input” widget and add text-to-speech greeting or an audio file from the prompt library. 
    Step 8: Scroll down and select “Amazon Lex” found next to “DTMF.” 
  • Step 9: Select your Amazon Lex bot from the dropdown menu, and the correct bot alias ($LATEST if you did not configure it). 
    Step 10: Add an intent (or multiple) to branch off into your contact flow. 

A multi-intent bot allows for the dynamic handling of even more complex user inquires, thus enriching your user experience to the maximum potential. The more intents your Lex bot is configured to handle, the less likely a user request will be left misunderstood (lowering the chance of having a frustrated customer). You might for example consider adding a second intent for user greetings, a third intent for store/business hours, etc. 

  • Step 11: Complete the rest of your contact flow. 
  • Step 12: Test your flow by assigning it to a phone number and calling in. 

Congratulations! You’ve now successfully embedded Amazon Lex into your Amazon Connect instance. The same underlying technology that powers Amazon Alexa and Amazon Lex is now integrated seamlessly into your contact flows, enhancing the contact center experience for your beloved customers! 


Contact Us

If you are interested in embedding Amazon Lex into Amazon Connect 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 and Amazon Lex. 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.

Rishi Jambunathan

Rishikumar Jambunathan is an experienced AWS solutions leader, Java/Twilio software engineer, and technical content writer working on Perficient's Custom Product Development team. He creates content focused on scalable, low-maintenance, secure AWS implementations of Amazon Lex bots, Amazon Connect contact centers, Twilio Flex, Twilio Studio, and various other technologies.

More from this Author

Follow Us