1 Answer
- Newest
- Most votes
- Most comments
1
Hello,
When using Lamnda code hook, you are expected to have the relevant slot values set in the session state in the Lambda response (post validation). I.e., in step 5 of your flow, ensure value of "firstName" slot is set. Otherwise, Lex bot will assume the first name is not set (perhaps because it didn't pass business validation), and reprompt the user.
Thanks
answered 4 years ago
Relevant content
- asked 6 months ago

The issue is that I already tried to set the slot values in the Lambda response, but on the next user input, those values I already set disappear, even if Lex accepted the JSON correctly or even if the slot value was encoded. For example: in step 5, I set an encoded "firstName" value, Lambda accepts it correctly, but when step 6 is triggered, the "firstName" slot goes back to null if I check CloudWatch logs.
I'm returning a JObject (Newtonsoft.JSON) that represents a JSON rather than a direct string representation of a JSON as I've seen elsewhere. could this be a problem? Apparently Lambda accepts it just fine and the JSON it produces is valid.
Maybe I'm doing something wrong or just Lex doesn't store session state and I have to track and validate everything myself but that doesn't seem to be the case as I've seen Python-JavaScript examples without this problem.