I'm really new to AWS Lex and AWS Lambda. I'm trying to send a response message to the user when he inserted an invalid slot value. I want the bot to write to the user "We do not have such type of bikes, the popular types are Men/Women/Unisex/Kids."
But it throws this error instead:
An error has occurred: Invalid Lambda Response: Received invalid response from Lambda: Can not construct instance of IntentResponse, problem: The validated object is null at [Source: {"isValid": false, "violatedSlot": "BikeType", "message": {"contentType": "PlainText", "content": "We do not have such type of bikes, the popular types are Men/Women/Unisex/Kids."}}; line: 1, column: 181]
The lambda function that creates the response:
def build_validation_result(is_valid, violated_slot, message_content):
if message_content is None:
return {
"isValid": is_valid,
"violatedSlot": violated_slot,
}
return {
'isValid': is_valid,
'violatedSlot': violated_slot,
'message': {'contentType': 'PlainText', 'content': message_content}
}
How should I fix the format to match AWS lambda response? Thanks.