Chatbots w/Amazon Lex

Recently, I attended a learning event put on by a local developer group: DevICT, which is a community for local developers in Wichita, KS.  The topic was Amazon Lex, a chat platform that you use to build your own chat bots.  Then these bots can respond to either text or voice from users and do useful things based on the outcomes of those interactions.

Setting up Lex is pretty straightforward.  After logging in to your AWS Console, you can navigate to the Lex product and it brings up your list of bots and controls to create new ones.  Once you’ve created a new bot, you’ll need to define Intents and Slots.  To put this in programmer parlance, if you think of your bot as an API framework or class, you could define Intents as methods and Slots as arguments.

For my bot’s first Intent, I took inspiration from a recent trip to the Jelly Belly jelly bean factory in California.  (The tour is free and great for the short people: i.e. kiddos)  So, I created an Intent called ‘IWantAJellyBean’ and seeded some phrases that would prompt the bot to start asking questions to fill in all the Slots.  This is the bridge between plain language and something the API can understand and the platforms language processing can imply the correct intent based on what you say or type.

Next, for my Slot, I created a short list of flavors.  This essentially acts as a type for fulfillment of the Intent.  When the Intent is invoked, a prompt that you configure in the framework adds a prompt to the chat to gather additional information from the customer.

Once all the information is gathered via the chat, the bot prompts one more time to confirm fulfillment of the order.  The confirmation is defined by the developer and you can determine the outcome based on the customer’s response.  Then, you can choose to trigger an event based on what happens as a result of the chat.  You can even leverage an AWS Lambda to take the results of the chat and trigger downstream activity.

Next comes the fun part: Talking to your bot!  This is mostly a debugging step but I was really impressed by how I was able to just use voice to walk through the test.  It’s very easy to see the potential of this platform to automate interactions with individuals and trigger requests or other business logic in your infrastructure.

I want to thank the individuals at DevICT for a fun and interesting learning experience.  If you happen to be in the Wichita area, I would highly suggest stopping by for their events, which can be found on Meetup or Facebook.

I’m interested in your experiences with Lex and AWS in general.  As always, if you have any questions or comments, please feel free to add them here or address them to john@benedettitech.com.

Thanks for looking in!