By using AWS re:Post, you agree to the Terms of Use

Questions tagged with Amazon Lex

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Interactive message sent in a response to a fulfilled intent breaks AWS Connect flow if proxy Lex v2 bot is created after August 17th

On August 17, 2022 Amazon Lex V2 released [a change to the way that conversations are managed with the user](https://docs.aws.amazon.com/lexv2/latest/dg/understanding-new-flows.html). It looks the change breaks AWS Connect flow if the underlying Lambda function sends an interactive message in a response to a fulfilled intent. Here's the AWS function Lambda function I use for testing: ``` const isNextStepElicitIntent=true; const useCustomPayload=true; exports.handler = async (event) => { console.log("Request " + JSON.stringify(event)); const customPayload={ "templateType":"ListPicker", "version":"1.0", "data":{ "content":{ "title":"Interactive Test", "subtitle":"Tap to select option", "elements":[ {"title":"Option 1"}, {"title":"Option 2"} ] } } }; var response; var message; if(useCustomPayload){ message={ "contentType": "CustomPayload", "content": JSON.stringify(customPayload) }; } else{ message={ "contentType": "PlainText", "content":"Help response" }; } if (isNextStepElicitIntent){ response = { "sessionState": { "sessionAttributes": {}, "dialogAction": { "type": "ElicitIntent" } }, "messages": [ message ] }; } else{ response = { "sessionState": { "sessionAttributes": {}, "dialogAction": { "type": "ElicitSlot", "slotToElicit": "DummySlot" }, "intent": { "name": "Help", "slots": { "DummySlot": null } } }, "messages": [ message ] }; } console.log("Response: " + JSON.stringify(response)); return response; }; ``` Use a Lex v2 bot created before August 17th, add a "Help" intent with "help" as an utterance, and a "DummySlot" to the intent, and check "Use a Lambda function for initialization and validation" in the "Code hooks" section. Connect the preferred alias/language combination of the Lex bot with the test Lambda function. Add the bot to a AWS Connect flow using a "Get customer input" block, and give flow a try with "Help" utterance. You will get the expected interactive message in the response. Do the same with a Lex v2 bot created after August 17th. AWS Connect goes to the "Error" output branch. In both cases, the Lex bot works fine when tested alone, so the problem is in Lex-Connect interaction. You may try changing isNextStepElicitIntent and useCustomPayload constants at the top of the Lambda function. It appears that everything works fine if the the response is plain text (const useCustomPayload=false;) , or if the dialogAction.type is "ElicitSlot" (const isNextStepElicitIntent=false;). The problem/bug appears only if the dialogAction.type is "ElicitIntent", the content of the response is an interactive message, and the Lex v2 bot is created after August 17th.
2
answers
0
votes
61
views
profile picture
asked a month ago

Amazon Lex and Cloudformation Compatibility Problems

Hello, Since the newest Lex v2 update of August 17th, a lot was added in the Lex console v2 regarding conditional flows and prompting. I'm using a Cloudformation template file to create the Lex bot ( https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lex-bot.html ) I have 2 questions for the AWS folks: 1. When do we expect to have the latest change from the Lex V2 to the Cloudformation template? 2. When creating a new Cloudformation stack with the exact same template I had before August 17th, is it normal my new Lex bot doesn't work as it used to (Lambda function is no longer triggered even with the DialogCodeHook setting enabled)? I'm experiencing ground breaking behaviors with the newest update. See below for the new problems I am experiencing, with the exact same template I had before. **Problems (That I can see for the moment, as mentioned, it is groundbreaking and I cannot use the newly created bot with the same template)** **Intent with Slots**: Intents with slots wasn't required to have the PromptSpecification setting ( https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lex-bot-slotvalueelicitationsetting.html ). The reason I don't set it is that I need this prompt to be dynamic. It was working before, now, it still works for the import, but I'm getting the following error in the testing console of Lex: "The maxRetries value is not in the specified inclusive range of 0 to 5. Check the maxAttempts parameter and try your request again". **Lambda function not called**: I'm not sure if this has anything to do with the new Initial response feature which can also call a Lambda function, but that is still to be defined in the Cloudformation template documentation. I'm not exactly sure what I did to make it work at some point, but I re-selected the same Lambda function over and over, saved and rebuilt the bot. Re-created a new IAM role, saved and rebuilt the bot. Repeated the same steps a few times and it started calling back my Lambda function again... Thanks,
2
answers
0
votes
234
views
asked a month ago