Support Topics Documentation Slack YouTube Blog

Alexa sdk getslotvalue


(Andrea Malaguti) #1

Hello,
i’m trying to use backendless alexa sdk for building a skill and i have a problem with getSlotValue method.
When i try to use it i get this:

Cannot read property ‘prototype’ of null

and this is the JSON i got:

{
“header”: {
“namespace”: “SkillDebugger”,
“name”: “CaptureDebuggingInfo”,
“messageId”: “7244ed5f-3350-4f59-aa25-a4aacfafd185”
},
“payload”: {
“skillId”: null,
“timestamp”: “2018-12-14T11:26:00.594Z”,
“dialogRequestId”: “20872743-b779-4afd-8caf-db8e0c83976d”,
“skillRequestId”: null,
“type”: “ConsideredIntents”,
“content”: {
“intents”: [
{
“name”: “fare”,
“confirmationStatus”: “NONE”,
“slots”: {
“giorno”: {
“name”: “giorno”,
“value”: null,
“confirmationStatus”: “NONE”
}
}
}
]
}
}
}

This is what i did on codeless: https://screenshots.firefox.com/x7RTHwGMhYIuFd9Q/develop.backendless.com
and this is the intents and slots in alexa: https://screenshots.firefox.com/0nLVnQUnsace8Z1g/developer.amazon.com

Am i missing something?
My idea is to get the name of the day that alexa service listen ( “lunedì”, “martedì”…created with that slot type) and do something against that, like ( if it return “lunedì” then do “works”, if it return “martedì” then do “go ride in bike” ).
Hope you can help sort out how to solve my problem, thanks in advice.


(Mark Piller) #2

Hi Andrea,

I’ll be happy to look into it. Could you please let me know your application ID?

Regards,
Mark


(Andrea Malaguti) #3

it’s not yet published, edited


(Mark Piller) #4

I actually need your Backendless application ID, it is a value you can get from the main dashboard screen in Backendless console.


(Andrea Malaguti) #5

it’s 0C15A418-38D9-AE58-FFB5-393C82A8BD00
sorry for the misunderstanding :slight_smile:

p.s. i’m doing some changes to try to find a way that fit my needs…if needed i’ll revert back my changes.


(Mark Piller) #6

No problem. I am looking at the JSON you posted and it doesn’t look like a valid Alexa request. Could you try the following please:

  1. Login to Alexa developer console and select your skill
  2. Switch to the Test tab and enable the skill for testing
  3. Type in what the user would say to trigger a request
  4. When you see the actual JSON request, please share it here so we can also test it on our side

(Andrea Malaguti) #7

sure, here it is:

{
“version”: “1.0”,
“session”: {
“new”: true,
“sessionId”: “amzn1.echo-api.session.366ffa9a-5b7d-4ab2-9c47-0664f0f510ba”,
“application”: {
“applicationId”: “amzn1.ask.skill.fd951174-aeb6-4818-9a30-b284f3d619b0”
},
“user”: {
“userId”: “amzn1.ask.account.AHI5XHSA5TCOOTYPWA6Y25BEHS6FXDASXMOKYAJ4MLHNDPX76LLNLNYZTBQKUYJ7MBPLDUKAZP7Z2BWTKM33BNURZL5E2VFUKOI62RSJHV2KRQI6CXM2WY3KNXSCJN6EHVK4WAAINZHPTQKGBZXBEMU6ZOXU5JENTDQO6J3EO53M7P546L7QV3DPQAEJIPFCAYWSFXJE3PAZUXQ”
}
},
“context”: {
“System”: {
“application”: {
“applicationId”: “amzn1.ask.skill.fd951174-aeb6-4818-9a30-b284f3d619b0”
},
“user”: {
“userId”: “amzn1.ask.account.AHI5XHSA5TCOOTYPWA6Y25BEHS6FXDASXMOKYAJ4MLHNDPX76LLNLNYZTBQKUYJ7MBPLDUKAZP7Z2BWTKM33BNURZL5E2VFUKOI62RSJHV2KRQI6CXM2WY3KNXSCJN6EHVK4WAAINZHPTQKGBZXBEMU6ZOXU5JENTDQO6J3EO53M7P546L7QV3DPQAEJIPFCAYWSFXJE3PAZUXQ”
},
“device”: {
“deviceId”: “amzn1.ask.device.AEJTBKRJJK4LXCBASDZQ7C6S37VIZQ3AVUTYMM2QPUJHKB5XHOIQZFPOFF6LD2U65473HGEL2HT2ATTHDUVL6I3THKVUZSNXGVJOP77Z4TCWH6GXI2KLZLUCKV4JHHEK4674YW4PLYC5T5N242MRCT57MY3LXBAEU27WNRPJ3JR3Z3OOIVVDE”,
“supportedInterfaces”: {}
},
“apiEndpoint”: “https://api.eu.amazonalexa.com”,
“apiAccessToken”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.eyJhdWQiOiJodHRwczovL2FwaS5hbWF6b25hbGV4YS5jb20iLCJp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Dh-oWVdEL5SJ4QrmcLd2fOw8uwd_wg9Y-O9DmYZSwYAH2g2Q4lGmyrGTUqx6VLDuICTwSIFEQzAPfSkpvsB3Ixib6nwHmlyEoZDgVnaFnogibQ”
},
“Viewport”: {
“experiences”: [
{
“arcMinuteWidth”: 246,
“arcMinuteHeight”: 144,
“canRotate”: false,
“canResize”: false
}
],
“shape”: “RECTANGLE”,
“pixelWidth”: 1024,
“pixelHeight”: 600,
“dpi”: 160,
“currentPixelWidth”: 1024,
“currentPixelHeight”: 600,
“touch”: [
“SINGLE”
]
}
},
“request”: {
“type”: “IntentRequest”,
“requestId”: “amzn1.echo-api.request.e5231815-2740-4f3e-a1e7-4ff181bb0d20”,
“timestamp”: “2018-12-14T16:46:41Z”,
“locale”: “it-IT”,
“intent”: {
“name”: “fare”,
“confirmationStatus”: “NONE”,
“slots”: {
“giorno”: {
“name”: “giorno”,
“confirmationStatus”: “NONE”
}
}
}
}
}

JSON Output is:

{
“body”: {
“version”: “1.0”,
“response”: {
“outputSpeech”: {
“type”: “SSML”,
“ssml”: “Cannot read property ‘prototype’ of null”
},
“directives”: [],
“shouldEndSession”: true
}
}
}


(Mark Piller) #8

This is because the slot value for the giorno slot is not filled. The value is not in the request. This tells me there is a problem with the slot/intent definition. The error you get in backendless happens because the following block returns undefined for the reason I just described:


(Andrea Malaguti) #9

i quite don’t understand, i’ve filled


and slot type with:

am i missing anything?

p.s. if you need, i can translate to english.

“giorno” is day
value on slot types like “lunedì” etcetc are the day’s name ( Monday…)


(Mark Piller) #10

What I am saying is when you submit an utterance, Amazon doesn’t put the slot value into the request. Here’s what it looks like (from what you sent earlier):

  "request": {
    "type": "IntentRequest",
    "requestId": "amzn1.echo-api.request.e5231815-2740-4f3e-a1e7-4ff181bb0d20",
    "timestamp": "2018-12-14T16:46:41Z",
    "locale": "it-IT",
    "intent": {
      "name": "fare",
      "confirmationStatus": "NONE",
      "slots": {
        "giorno": {
          "name": "giorno",
          "confirmationStatus": "NONE"
        }
      }
    }

As you can see, there is no value for the giorno slot.

Regards,
Mark


(Andrea Malaguti) #11

Well, i think i discovered what is wrong.
I dont’ have to use the Object slot ( Get Object Count, table name ), in that case i got:

Table not found by name ‘Table not found by name ‘rome’. Make sure the client class referenced in the API call has the same literal name as the table in Backendless console’

To get the value of my slot type i have to modify as this image:

After that i get the value “rome” :slight_smile:

JSON Output

{
“body”: {
“version”: “1.0”,
“response”: {
“outputSpeech”: {
“type”: “SSML”,
“ssml”: ““bologna””
},
“directives”: [],
“shouldEndSession”: true
}
}
}


(Mark Piller) #12

I am glad you found the issue. Are you able to move forward with your implementation? Any blockers now?


(Andrea Malaguti) #13

hahaha, i spent hours for this, for a single word :joy:
Anyway, i’m blocked cause of Alexa Simulator, it’s broken as of now ( here in Italy ) and i didn’t get any written answer, only audio response text.
If i test it on my phone it replies the city name correctly…:face_with_raised_eyebrow:
But it’s not my idea to receive an alexa response with the slot value, but use that value for other purposes.
Beside this alexa issue, i wish to read the data in a table i made…and if it can be fullfilled by a form, like a php form, a google doc module, or something like this. Users should be able to compile it.
Or, as an alternative, read and append from an XML or JSON file.
So with an association with slot value and a key i get the data that i want, this time as an alexa response.


(Mark Piller) #14

That’s one small step for man, one giant leap for mankind :slight_smile:

You can apply the logic in Codeless to manipulate the data you get from the Alexa request and execute it against the table, files, users - pretty much anything available in Backendless. You can also read the data from your table with our APIs in a webform, Android/iOS/JS app. Same goes for working with XML or JSON files.


(Andrea Malaguti) #15

Thanks, i’ll look into it.
I was considering using a mongodb db, but after using backendless i’ll try its data capabilities…and to avoid possible timeouts, i see that using the handlerequest from the api services it tooks a bit compared to lambda, at least at first invocation. Maybe cause i’m in Italy, dunno.
I’m a bit off topic regarding the getslotvalue, but…is it possible to use the built-in alexa service to play an audio or a streaming( m3u8 )?


(Mark Piller) #16

Yes, I believe it should be possible to play audio. What should be in the response to do that? A file URL?


(Andrea Malaguti) #17

yes, an URL pointing to an MP3 or m3u8 file