I have set up a bot in lex console that collects data from users such as the product/service that they are interested in and email-ID, Phone number etc. Now every time a visitor interacts with the bot I would want to receive an email with chat conversations.
I also created a lambda function that is triggered by lex fulfilment but i get this error on bot ui An error has occurred: Invalid Lambda Response: Received invalid response from Lambda: Can not construct instance of IntentResponse: no String-argument constructor/factory method to deserialize from String value
As per the documentation I have reconstructed a response and returning it.
import json
def lambda_handler(event, context):
print(event)
var1 = '''dialogAction": {
"type": "close",
"fulfillmentState": "fulfilled",
"message": {
"contentType": "PlainText or SSML or CustomPayload",
"content": "Message to convey to the user. For example, What size pizza would you like?"
},
}
}'''
return(var1)
And here is what the error looks like:-
An error has occurred: Invalid Lambda Response: Received invalid response from Lambda: Can not construct instance of IntentResponse: no String-argument constructor/factory method to deserialize from String value ('"dialogAction": { "type": "close", "fulfillmentState": "fulfilled", "message": { "contentType": "PlainText or SSML or CustomPayload", "content": "Message to convey to the user. For example, What size pizza would you like?" }, } }') at [Source: "\"dialogAction\": {\n \"type\": \"close\",\n \"fulfillmentState\": \"fulfilled\",\n \"message\": {\n \"contentType\": \"PlainText or SSML or CustomPayload\",\n \"content\": \"Message to convey to the user. For example, What size pizza would you like?\"\n },\n }\n }"; line: 1, column: 1]