I've followed tutorials to setup Lex&Lambda. My lambda function returns
return {
"dialogAction": {
"type": "ConfirmIntent",
"intentName": "GetPersonInfo",
"message": {
"contentType": "PlainText",
"content": ""
}
}
}
and Lex displays it as single message. When I'm building my bot on aws site I can setup multiple messages as answer(without using lambda) and I would like to do that with lambda function just like on img: https://docs.aws.amazon.com/lex/latest/dg/images/default-response-25a.png.
On aws site I've prepared output for multiple messages and it look like this:
{
"dialogState": "Fulfilled",
"intentName": "GetPersonInfo",
"message": "{\"messages\":[{\"type\":\"PlainText\",\"group\":1,\"value\":\"siema siemanko\"},{\"type\":\"CustomPayload\",\"group\":2,\"value\":\"{\\\"moj\\\":\\\"json\\\"}\"}]}",
"messageFormat": "Composite",
...
}
I've noticed that Lex expect "dialogAction" as lambda output and multiple message feature is used in "PostText" and "PostContent". I know, that dialogAction is used to build PostText/PostContent object.
I also would like to send different message to speech, different to display as text and another as a JSON (for my Frontend). Right now my solution is to send everything as PlainText message in dialogAction object and then via my front end execute Polly to read message prepared for speach. Is this possible to do such stuff just with Lex and lambda?