Skip to content Skip to sidebar Skip to footer

Trouble With Amazon Lex Chatbot Slots

I am trying to create a chatbot. Chatbot will prompt the question 'What is your nationality? (A, B, C)' and if the user says C, I want to straight away end the chat by saying somet

Solution 1:

After unchecking the required checkbox, in the lambda code do below:

# inside dialogcodehook
slots = intent_request['currentIntent']['slots']
nation = slots['nation']
if nation == 'C':
    returnclose('I am sorry, C is not applicable to apply. Only A and B can apply.')
# rest of your code

def close(msg):
"dialogAction": {
    "type": "Close",
    "fulfillmentState": "Fulfilled",
    "message": {
      "contentType": "PlainText",
      "content": msg
    }
}

You may want to see this question, this question, this question, this documentation etc..

Play with it and see documentation for other things and comment for further doubts.

Hope it helps.

Post a Comment for "Trouble With Amazon Lex Chatbot Slots"