In the previous exercise you saw that Option 2 (using Entity Resolution) is faster and easier to maintain. Where can you access these synonyms? In the JSON request.
When users interact with your skill, Alexa sends off a JSON request to your AWS Lambda function that looks something like the text file — request.js shown on the right. If your skill uses entity resolution, the JSON request includes some additional important information, including the synonym Alexa heard, the status code of the resolution, and the resolved value.
In Node, we can access the synonym using:
YOUR_SLOT_NAME is the desired slot.
We can access the status code using:
We can access the resolved value using:
Let’s do a little bit of practice with a sample JSON request.
this, and start with
console.log(), print the synonym in the JSON request.
console.log(), print the status code in the JSON request.
console.log(), print the resolved value in the JSON request.