How to Add an Amazon Lex Bot to Amazon Connect


Follow these guidelines to set up an Amazon Lex bot and capture customer inputs

Want to have an automated conversational tool to deal with clients? Want to give your customers a naturally pleasant experience on auto-pilot while they interact with your business?

Amazon Web Services continuously innovates to improve their services and bring convenience to their clients, and that is what makes them stand out. They have heaps of features rolled out to cater to client needs, and Amazon Lex is one of them. 

Amazon Connect’s Amazon Lex chatbot engine lets you build conversational bots powered by state-of-the-art artificial intelligence. This means you don’t have to allocate human resources to repetitive customer service interactions anymore. 

Amazon Lex offers a cost-effective method to easily add AI-based bots to your customer-facing business processes. These bots have the ability to understand intent and context across different languages. 

A 9-step guide to adding Amazon Lex bot to Amazon Connect

Amazon connect not only provides natural interactions to customers, but it also has the option to capture customer inputs as digits entered on numeric keypads. Follow these nine steps to activate these functions. 

1. Prerequisites

To set up the Lex bot, you need to fulfill a couple of prerequisites. You should have an AWS account and an Amazon Connect instance. 

2. Creating a bot

These steps will show you how to create a bot that demonstrates a Say or Press integration to Amazon Connect. The bot will prompt callers to say or press a number matching the menu option, which will complete the task. The input will be checking the balance account. 

  • Open the Amazon Lex console and choose Create bot.
  • Go to Configure Bot Settings. Click on Create – create a blank bot and name the bot AccountBalance. In the IAM section, select a role if you have already created one. Otherwise, create a role that has basic Amazon Lex permissions. 
  • Enter the other configuration settings and press Next.
  • Set voice- and language-specific information. The default voice for Amazon Connect is Joanna. Select locale and language from the available list and choose Done. The Amazon Lex bot will be created, and the Intent page will be displayed.

3. Configuring the bot

These steps entail configuring the bot for two intents. One intent is to look up account information, and the other is to talk with an agent. 

Creating account lookup intent

Go to the Intent page of Amazon Lex console and enter AccountLookup in the Intent name box.

  • Go to Sample Utterances and add the utterance Check my account balance and One. Adding One will assign the keypress of 1 or the utterance of One to the AccountLookup intent.
  • Now go to the Slots section. Choose Add Slot. Check Required for this intent. Type the Name as AccountNumber. And Select Slot type as AMAZON.Number
  • In the Prompts section, add the text you’d like to be spoken when the customer call is answered. You can use the following prompt: Using your keypad, enter your account number, please.
  • Go to the Closing response section and add a message that would be delivered by the bot. To simplify things, just put a random number here instead of getting the data, which you will have to do in a real situation. You can add the following response: Your account balance is $1,234.
  • Choose Save intent.

Creating Speak to agent intent

  • In the Intent Name box, add SpeakToAgent.
  • Go to Sample Utterances and add the utterance Speak to agent and Two.
  • Go to the Closing response section and add a message such as An agent will talk to you shortly.
  • Choose Save intent.

4. Building and testing the bot

To ensure your bot is working properly, go to the bottom of the page and choose Build and then click Test

Check both the AccountLookup and SpeakToAgent intent. For more information on this, go to this page

5. Creating an Alias for the bot

In the Amazon Lex console, go to the Aliases page and choose Create alias. Feed a name such as Test in the Alias name box and choose Create. This alias will later be used to specify your bot in the contact flow. 

6. Adding the bot to your Amazon Connect instance

  • In the Amazon Connect console, select the instance that you want to integrate with your bot. 
  • Go to the navigation menu and click on Contact flows.
  • To select your bot, use the dropdown under Amazon Lex to select the region of your bot and then select AccountBalance
  • In the Alias dropdown, select Test and choose + Add Lex Bot.

7. Creating a contact flow and adding the bot

While creating a new contact flow that uses your bot, you will have to configure the messages for the callers. Here is how to do it. 

  • Log into the Amazon Connect instance with an account that has permissions for contact flows and Lex bots. 
  • Go to the navigation menu and choose Routing, Contact flows, Create contact flow and enter a name for the flow.
  • Under the section Interact, drag a Get customer input block onto the designer, and once it’s done, get it connected to the Entry point block.
  • Choose Chat text or Text to speech in the Get customer input block and choose Enter text. Feed a message that matches the bot’s intent, such as:
    To check account balance, say or press 1.
    To talk to an agent, say or press 2.
  • Now select the Amazon Lex tab, and in the name dropdown, select AccountBalance. Under the alias dropdown, select Test.
  • Under Intents, choose Add an intent. Type AccountLookup and click on Choose another intent. Now type SpeakToAgent and click on Save.

8. Finishing the contact flow

This step is about adding segments to the contact flow that function once the caller interacts with the bot.

A Prompt block is employed to play a message and disconnect the call if the caller wishes to know the account balance and presses 1.

A Set queue block is used to set a queue and transfer the caller to the queue if the caller wants to talk to the agent and presses 2. 

Detailed information about setting these blocks can be found on this page.

9. Assigning the contact flow to a phone number

You will need to assign the contact flow to the telephone number for the bot to be activated for that number. Here is how to do it.

  • Go to the Amazon Connect console, Choose Routing and then choose Phone numbers
  • You can now select the phone number you want to assign to the contact flow on the Manage Phone Numbers page. 
  • Add a description to the selected phone number. 
  • Now go to the Contact flow/IVR menu and choose the contact flow that was created. 
  • Choose Save.

Call the assigned number and follow the prompts to make sure the bot is working fine. 


CloudHesive is here to attend to all your AWS-related issues. We have vast experience in providing AWS solutions, and you can contact us today to get started.

Related Blogs

  • Exploring the Role of Amazon Web Services (AWS) Tools for DevOps Implementation in Cloud Projects

    Integrating DevOps best practices into cloud projects presents a few inherent challenges. With the help of AWS Tools for DevOps, processes can be streamlined for better cloud project management....

    Learn More
  • Optimizing Cloud Operations and Cost with DevOps Planning

    DevOps planning tips and tricks can help your organization balance operational efficiency and cost management. Even though implementing DevOps planning comes with many well-known benefits within the...

    Learn More
  • Key DevOps Trends: How They Shape the Future of Cloud Computing

    Staying on top of the rapidly evolving world of DevOps is challenging. Using prevalent DevOps trends can significantly impact project success in the evolution of cloud computing.  Considering the...

    Learn More