question

RESPONSE // READY avatar image
RESPONSE // READY asked ·

Unable to retrieve Slot ID in my Lambda Function!

"request": {
    "type": "IntentRequest",
    "requestId": "amzn1.echo-api.request.f03d80fe-4d4c-4eab-9b3e-d440cec88cc9",
    "timestamp": "2018-03-25T16:53:54Z",
    "locale": "de-DE",
    "intent": {
        "name": "AnswerIntent",
        "confirmationStatus": "NONE",
        "slots": {
            "songs": {
                "name": "songs",
                "value": "tik tok",
                "resolutions": {
                    "resolutionsPerAuthority": [{
                        "authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.6f40d0e8-f9de-4a04-8487-5e515b978378.songs",
                        "status": {
                            "code": "ER_SUCCESS_MATCH"
                        },
                        "values": [{
                            "value": {
                                "name": "tiktok",
                                "id": "1"
                            }
                        }]
                    }]
                },
                "confirmationStatus": "NONE"
            }
        }
    }
}

The Voice Service is passing the Slot ID Information but I am unable to access it in my NodeJS Lambda...

var c = this.event.request.intent.slots.songs.resolutions.resolutionsPerAuthority.values.value.id;

It is returning "null". Does anyone know how to solve this problem? Could not find a solution yet...

Thank you!

alexa skills kitlambdaslots
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jenn@amazon avatar image
Jenn@amazon answered ·

It should be:

var c = this.event.request.intent.slots.songs.resolutions.resolutionsPerAuthority[0].values[0].value.id

resolutionsPerAuthority and values are Object Arrays, so it needs the index number.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

RESPONSE // READY avatar image
RESPONSE // READY answered ·

Thank you! That worked for me. Thought I had tried that solution before....

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.