I have been following the youtube tutorial : https://www.youtube.com/watch?v=HkMi5xPyz1g&t=1533s
public Object handleRequest(Map<String,Object> input, Context context) {
LexRequest lexRequest= LexRequestFactory.createLexRequest(input);
String orgbotcommand= lexRequest.getCommand()+" "+lexRequest.getOld_variable();
String content = String.format("command recieved by %s is %s",
lexRequest.getBotName(),
orgbotcommand);
Message message = new Message("Plain text",content);
DialogueAction dialogueAction = new DialogueAction("Close", "Fulfilled or Failed", message );
System.out.println(dialogueAction);
return new LexRespond(dialogueAction);
}
Above is the java code i am using.
it is giving me the desired output while testing with lambda function test events, but when i try to call this lambda function from my lex bot , it throws the error below:
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: {"dialogueAction":
{"type":"Close","fulfillmentState":"Fulfilled or Failed","message":
{"contentType":"Plain text","content":"command recieved by OrgBot is Delete asd"}}}; line: 1, column: 168]
Output in lambda test event is :
{
"dialogueAction": {
"type": "Close",
"fulfillmentState": "Fulfilled or Failed",
"message": {
"contentType": "Plain text",
"content": "command recieved by OrgBotchatbot is delete asd"
}
}
}
I am new to Amazan lex and lambda. Please tell me what i am doing wrong