Build an AI powered customer service voice agent on AWS

Cloud | AWS | DevOps | AI 📍 Toronto 🇨🇦 🚀 Cloud Architect @ AWS 👨🏽🏫 Professor
Search for a command to run...

Cloud | AWS | DevOps | AI 📍 Toronto 🇨🇦 🚀 Cloud Architect @ AWS 👨🏽🏫 Professor
No comments yet. Be the first to comment.
Most AWS environments carry somewhere between 20% and 35% in avoidable spend. This is not a controversial claim. Industry reports from Flexera and Gartner have consistently placed cloud waste in that

You're building on AWS. You know your workload needs compute. And now you're staring at three options. ECS, EKS, and Lambda. Each with its own ecosystem of blog posts telling you it's the right choice

A few weeks ago I wrote about building a multi agent system on my old personal laptop. You can read more about it here. This project failed miserably because of my hardware limitations. My hardware wa

I like soccer and Real Madrid, but I’m not the diehard kind who can recite every fixture by heart. So naturally, I end up missing mid-week games and that usually end up to be the best matches. I wante

In the rapidly evolving landscape of Generative AI, giving your LLM (Large Language Model) access to real-time data and specialized tools is the difference between a generic chatbot and a powerful AI assistant. AWS has embraced the Model Context Prot...

A few weeks ago, I found myself in Vegas, trying to update a dinner reservation on a packed Saturday night. Calling the restaurant was useless—there was no chance of getting through. That got me thinking: how quickly could I spin up an AI-powered reservation assistant?
So, I put it to the test. In under an hour, I built a crude proof of concept (PoC) using AWS services. The setup was simple:
Amazon Connect to handle incoming calls
Amazon Lex for voice interaction and capturing reservation details
AWS Lambda to process and store the reservation
Amazon DynamoDB for storing reservations
Amazon SES to send confirmation emails
This isn’t about cutting-edge AI. It’s about solving real problems—fast. AI isn’t useful unless it’s applied to the right problem, and once you do that, impact follows almost instantly.
Now, let’s dive into how I built it.

Go to the AWS Console → Amazon Connect → Create an instance.
Set up an administrator account and choose a name for the instance.
Follow the instance creation flow to claim a phone number and use it for incoming calls
Now, whenever someone calls this number, we can define what happens next using a contact flow.
A contact flow is a set of actions Amazon Connect follows when handling a call. Under bot create a Lex bot. After configuring the bot, create an “intent” to capture user request to make reservations.
Additionally, the call flow I configured a welcome prompt and terminating the call after capturing the required information
Amazon Lex is AWS’s conversational AI service, handling both text and voice inputs.
In Amazon Lex, create a new bot called ReservationBot.
Under Intents, create a new intent called MakeReservation.
Add sample utterances like:
I want to make a reservation
Can I book a table for tonight?
Reserve a table for two at 7 PM
Add Slots to Capture User Data
Slots are variables that store user inputs. Add the following slots to MakeReservation:
| Slot Name | Type | Prompt Example | Required? |
firstName | AMAZON.FirstName | What name should I book under? | Yes |
phoneNumber | AMAZON.PhoneNumber | Can I get your phone number? | Yes |
partySize | AMAZON.Number | How many people are in your party? | Yes |
date | AMAZON.Date | What date do you need the reservation for? | Yes |
time | AMAZON.Time | What time would you like the reservation? | Yes |
confirmation | AMAZON.YesNo | Should I confirm your reservation? | Yes |
Configure Fulfillment with AWS Lambda
Once Lex collects user input, we need to process the reservation and store it in DynamoDB.
In Lex, go to the Fulfillment section.
Select AWS Lambda function and create a new function.
Use the following Python code:
import boto3
import uuid
dynamodb = boto3.resource("dynamodb")
table = dynamodb.Table("Reservations")
def lambda_handler(event, context):
slots = event["currentIntent"]["slots"]
reservation_id = str(uuid.uuid4())
reservation_data = {
"ReservationID": reservation_id,
"FirstName": slots["firstName"],
"PhoneNumber": slots["phoneNumber"],
"PartySize": slots["partySize"],
"Date": slots["date"],
"Time": slots["time"]
}
table.put_item(Item=reservation_data)
return {
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled",
"message": {
"contentType": "PlainText",
"content": f"Your reservation is confirmed, {slots['firstName']}! Your confirmation ID is {reservation_id}."
}
}
}
This function:
✅ Extracts user inputs from Lex
✅ Generates a unique reservation ID
✅ Stores the reservation in DynamoDB
✅ Returns a confirmation message
Once the reservation is stored, we want to send a confirmation email. Modify the Lambda function to include this:
def send_email(to_address, first_name, reservation_id):
subject = "Your Reservation is Confirmed!"
body = f"Hello {first_name},\n\nYour reservation is confirmed. Your confirmation ID is {reservation_id}.\n\nThank you!"
response = ses.send_email(
Source="your-email@example.com",
Destination={"ToAddresses": [to_address]},
Message={
"Subject": {"Data": subject},
"Body": {"Text": {"Data": body}}
}
)
return response
Update the lambda_handler function to call send_email():
send_email(slots["phoneNumber"] + "@example.com", slots["firstName"], reservation_id)
Now, once a reservation is made, an email confirmation is sent to the customer.
Test the Call Flow in Amazon Connect
Call the phone number assigned to Amazon Connect.
Try making a reservation by voice.
Ensure the data is stored in DynamoDB and a confirmation email is sent.
This setup isn’t complex, and that’s the beauty of it. In under an hour, we built a fully functional AI-powered reservation system using AWS services. The key takeaways:
✅ Amazon Connect + Lex makes voice call automation easy.
✅ Lambda + DynamoDB handles backend processing and storage.
✅ Amazon SES automates email confirmations.
This solution can be expanded in many ways—multi-language support, SMS confirmations via SNS, or even integrating with restaurant POS systems. But the core idea remains: AI is most effective when applied to the right problems.