Back to Blog
Amazon Connect

Amazon Connect + Lex: Build a Conversational IVR

Replace "Press 1 for sales" with natural language. Let customers say what they need and route them intelligently—using Amazon Lex's speech recognition and NLU.

12 min readJan 23, 2026

Why Add Lex to Amazon Connect?

  • Natural language: Customers speak naturally instead of pressing buttons
  • Self-service: Automate common requests (check order status, reset password)
  • Faster routing: Understand intent immediately vs. multi-level menus
  • 24/7 availability: Handle queries even when agents are offline

How It Works

According to AWS documentation, Amazon Lex provides automatic speech recognition (ASR) and natural language understanding (NLU). When integrated with Amazon Connect:

1Customer calls your Amazon Connect number
2Contact flow triggers a Lex bot
3Lex converts speech to text (ASR)
4Lex identifies intent and extracts entities (NLU)
5Bot responds or hands off to appropriate queue
6If needed, Lambda functions process backend logic

Step 1: Create a Lex V2 Bot

We'll use Amazon Lex V2 (the newer version). According to AWS, Lex V2 offers improved streaming, better multi-turn conversation handling, and simplified bot management.

1Go to Amazon Lex in AWS Console → Create bot
2Choose 'Create a blank bot'
3Name: 'CustomerServiceBot'
4IAM role: Create a new role with basic Lex permissions
5COPPA: Select 'No' (not directed at children)
6Language: English (AU) for Australian accent recognition
7Voice: Choose an Amazon Polly voice (e.g., Olivia for Australian English)
8Click 'Done' to create the bot

Step 2: Define Intents

Intents represent what the customer wants to do. Let's create three common intents:

CheckOrderStatus

Sample utterances:

  • • "Where is my order?"
  • • "I want to track my package"
  • • "Check order status"
  • • "When will my order arrive?"
SpeakToAgent

Sample utterances:

  • • "I need to speak to someone"
  • • "Transfer me to an agent"
  • • "Talk to a human"
  • • "Representative please"
ReturnItem

Sample utterances:

  • • "I want to return something"
  • • "How do I make a return?"
  • • "Return my order"
  • • "I need a refund"

Adding Slots (Variables)

For CheckOrderStatus, we need the order number. Add a slot:

Slot name: OrderNumber
Slot type: AMAZON.AlphaNumeric
Prompt: "What's your order number?"

Step 3: Build and Test the Bot

Click 'Build' in the Lex console (takes 1-2 minutes)
Use the test window to try utterances
Verify intents are recognized correctly
Adjust utterances if recognition is poor
Create a bot alias (e.g., 'Production') - don't use TestBotAlias in production

Step 4: Connect Lex to Amazon Connect

Now we link the bot to your contact center.

1In Amazon Connect, go to your instance settings
2Under 'Contact flows', find 'Amazon Lex' section
3Click 'Add Amazon Lex bot'
4Select your region and bot name
5Choose the alias you created
6Save changes

Step 5: Update Your Contact Flow

Modify your contact flow to use the Lex bot instead of DTMF input.

1Open your contact flow in the editor
2Add a 'Set voice' block (must match Lex bot language)
3Add 'Get customer input' block
4Select 'Amazon Lex' instead of 'Text to speech'
5Choose your bot and alias
6Map intent outcomes to branches (e.g., CheckOrderStatus → Lambda)
7Add fallback branch for unrecognized intents → transfer to agent
8Save and publish

Step 6: Add Lambda for Backend Logic (Optional)

For intents like CheckOrderStatus, you need backend integration. According to AWS, Lambda functions can be invoked during dialog or fulfillment.

Example Lambda (Python)
import json

def lambda_handler(event, context):
    intent_name = event['sessionState']['intent']['name']

    if intent_name == 'CheckOrderStatus':
        order_number = event['sessionState']['intent']['slots']['OrderNumber']['value']['interpretedValue']

        # Call your order API here
        status = get_order_status(order_number)  # Your function

        return {
            'sessionState': {
                'dialogAction': {'type': 'Close'},
                'intent': {
                    'name': intent_name,
                    'state': 'Fulfilled'
                }
            },
            'messages': [{
                'contentType': 'PlainText',
                'content': f'Your order {order_number} is {status}'
            }]
        }

def get_order_status(order_number):
    # Replace with actual API call
    return "out for delivery"

Best Practices

Use production aliases, not TestBotAlias

TestBotAlias has limited concurrent call support

Match language settings

Lex bot language must match the Set Voice block in Connect

Add plenty of utterance variations

People phrase things differently—train for diversity

Always have a fallback to human agent

Some requests need human handling; don't trap customers

Test with real accents

If targeting Australia, test with Australian speakers

Adding Generative AI (Advanced)

For more sophisticated conversations, you can enhance Lex with Amazon Bedrock. According to AWS, this allows the bot to handle complex queries that don't match predefined intents by passing them to a foundation model.

Sources

Need a Custom AI Voice Bot for Your Contact Center?

We build conversational IVRs that actually work—trained on your specific use cases, integrated with your backend systems, and optimized for Australian accents.

18+ years enterprise experience, including Lex implementations for energy sector contact centers.

Book Lex Integration Consultation