Users may not say everything you expect. They may just say "my name is". We can use a function that returns either null, or the value of the slot.
For example, if you had set slotName = "FirstName", you could check it via:
var slotValue = isSlotValid(this.event.request, slotName); //slot value or false
if (slotValue) { } else { }
- Create a new AWS Lambda function using the fact blueprint.
- Delete the code, replace with index.js
- Locate and Copy the AWS Lambda ARN for the new function.
- Create a skill with a slot called Item
- On the Configuration page, paste in your Lambda ARN as the endpoint.
- Test your skill, both with and without saying slot words.
- Copy the
isSlotValid()
helper function to use in your code.