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.
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:
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.
Step 2: Define Intents
Intents represent what the customer wants to do. Let's create three common intents:
Sample utterances:
- • "Where is my order?"
- • "I want to track my package"
- • "Check order status"
- • "When will my order arrive?"
Sample utterances:
- • "I need to speak to someone"
- • "Transfer me to an agent"
- • "Talk to a human"
- • "Representative please"
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:
Step 3: Build and Test the Bot
Step 4: Connect Lex to Amazon Connect
Now we link the bot to your contact center.
Step 5: Update Your Contact Flow
Modify your contact flow to use the Lex bot instead of DTMF input.
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.
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
TestBotAlias has limited concurrent call support
Lex bot language must match the Set Voice block in Connect
People phrase things differently—train for diversity
Some requests need human handling; don't trap customers
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