1 Answer
- Newest
- Most votes
- Most comments
0
In Amazon Lex, you can use composite slot types to collect multiple pieces of information within a single slot.
For a fullName slot with firstName and lastName subslots, you can reference these subslots individually in your responses or in your code. For example, you can use sessionAttributes.fullName.firstName to say “Thanks, John” instead of “Thanks, John Doe”.
If you have collected car details using a composite slot type, you can run conditionals on the subslots. For example, you can check sessionAttributes.car.year to give different responses for older and newer cars. You can also reference the model subslot as sessionAttributes.car.model to say “We’ll take great care of your Camry”.
Relevant content
- asked 3 years ago
- asked a year ago
- AWS OFFICIALUpdated 3 years ago

Based on your comment, it sounds like this is simple in a repo-driven Lex bot. How exactly would I do this if I built my bot in the web interface? I'm a JS engineer, but I've only built bots in the web interface because some of my team members aren't.
I also didn't understand the use of a Session Attribute. Does your method not work for slots? Do I first need to save the slot data to a session attribute? I've tried adding {user.firstName} to my response text and to conditionals, where user is the slot name of type fullName. It failed as invalid. Please advise.