Search code examples
amazon-web-servicesaws-lambdaamazon-lex

How can I use AWS Lex to ask multiple yes/no questions?


I am trying to create a custom slot type to hold the user response for yes / no values but it looks like Lex does not recognize Yes, No or Sure as input on my custom slot type. Are there limits with slot types on what values should we use?

I was hoping to use Lex as a way to solve basic helpdesk problems before forwarding a user on to a human. My questions are things like "Have you turned it off an on?", which I'm expecting a "yes/no" response.

It seems like Lex is unable to understand these answers.


Solution

  • I found a hacky solution.

    Within your Lambda function, continuously respond with ConfirmIntent and check intentRequest.currentIntent.confirmationStatus for Confirmed and Denied. State can be managed through a slot parameter or outputSessionAttribute (e.g. incrementing an integer).

    This feels like it's breaking the intended flow process of Lex, but it gets the job done.

    Please post an answer if you think there is a better way