2 Answers
- Newest
- Most votes
- Most comments
0
Ok, I initially did not think it was a format issue at first but it is. The response is in the correct format that Lex can receive except my 'message' portion which was in the incorrect format.
answered a year ago
0
Can you try to use JSON.dumps (if using python) or similar to what JSON.stringify does for Javascript? Wrap the whole response object.
Relevant content
- asked 9 months ago
- asked 3 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
I tried that, this is what I get on the lex chat side : Invalid Lambda Response: Received invalid response from Lambda: Cannot construct instance of
IntentResponse
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('{"sessionState": {"activeContexts":...<rest of the lambda response>.here is where I get the response right before I send it back to lex : print(f"Response: {intent_name} -> Lambda: {fn_name} : {payload}") the resulting log : Response: ListProducts -> Lambda: LexListProducts : { "sessionState": { "activeContexts": [ { "name": "intentContext", "contextAttributes": {}, "timeToLive": { "timeToLiveInSeconds": 600, "turnsToLive": 1 } } ], "sessionAttributes": {}, "dialogAction": { "type": "Close" }, "intent": { "confirmationState": "None", "name": "ListProducts", "slots": {}, "state": "InProgress" } }, "messages": [ { "contentType": "PlainText", "content": { "contentType": "PlainText", "content": "On vend des pommes" } } ] }