Closed roschler closed 6 years ago
Hi @roschler,
I think you should use AMAZON.LITERAL
instead of just LITERAL
in your schema definition. If you are using the Alexa test simulator, you will also be able to see the exact request with the slot value (if any) when being sent to your app.
Pay attention that custom types are better than literals, so you might want to migrate to your own type in the future.
Also, you might want to read a slot value using the slot
method:
function (request, response) {
response.say(request.slot('ANSWER'));
}
Hello kobim,
I changed it to AMAZON.LITERAL and that didn't help. But given your reminder to inspect the JSON payload sent by the simulator reveals something troubling. If you look at the dump below, you will see that nowhere in the payload is the text I entered, that of the "test". There's something that is keeping the simulator from sending me the text I input? Therefore, it is no surprise the slot has no value by the time alexa-app rehashes it into the request object it provides to intent handlers.
I'm beginning to worry that there is some weird problem somewhere else? What else could cause the simulator to not send the text input I entered? In the meantime, thank you for your reply and I will investigate custom types.
Here is the simulator payload with the sensitive strings hidden:
{
"version": "1.0",
"session": {
"new": false,
"sessionId": <hidden>,
"application": {
"applicationId": <hidden>
},
"user": {
"userId": <hidden>
}
},
"context": {
"AudioPlayer": {
"playerActivity": "IDLE"
},
"Display": {
"token": ""
},
"System": {
"application": {
"applicationId": <hidden>
},
"user": {
"userId": <hidden>
},
"device": {
"deviceId": <hidden>
"supportedInterfaces": {
"AudioPlayer": {},
"Display": {
"templateVersion": "1.0",
"markupVersion": "1.0"
}
}
},
"apiEndpoint": "https://api.amazonalexa.com",
"apiAccessToken": <hidden>
}
},
"request": {
"type": "IntentRequest",
"requestId": <hidden>
"timestamp": "2018-04-24T20:30:45Z",
"locale": "en-US",
"intent": {
"name": "tellme",
"confirmationStatus": "NONE",
"slots": {
"answer": {
"name": "answer",
"confirmationStatus": "NONE"
}
}
}
}
}
Can you show me your interaction model?
I also noticed your utterances don't contain the slot. Try to change "user input"
to "tell me {answer}"
(under samples
in the schema) and try to invoke tell me something
in the text simulator.
Hi Kobi,
What are you calling the "interaction model"? Are you referring to the content on the Alexa Skill model builder page?:
Note, I completely revamped my model to have an intent called _searchquery with a single slot named _userinput and a single utterance that uses that slot defined as "the {user_input}".
This is getting text sent to me but unfortunately, only if I prefix the text with the word "the". This is a problem because I want to get any text the user says, not only if it begins with "the". Note, I changed from AMAZON.LITERAL to AMAZON.SearchQuery because I read that on Stack Overfow AMAZON.LITERAL was deprecated. Is this so?
Also, there seems to be an overlap/duplication between the app.intent() definition in alexa-app handlers and the Alexa Skill model building page. I assume my app.intent() definition has to include a matching intent name for it to be routed to when my Node.JS app receives request (and it is working). But the slot and utterance definitions seem to overlap/duplicate what I define in the Alexa Skill model building page and I'm worried what that means in practice if there are variances between the utterances and slots defined on either side (i.e. - between the definitions found in the Alexa Skill model builder side and the code in my app.intent() definition in my Node.JS app that handles the similarly named intent).
The slot/utterance ("schema") passed to the intent
function are used to generate the JSON for the interaction model and are optional.
Regarding the AMAZON.LITERAL
deprecation comments, refer to the using custom types
link I provided earlier, as its better to define EXACTLY what you attempt to receive.
I'm closing this issue as it doesn't seem an issue with the library but with an understanding about interaction with an Alexa skill. Please refer to Understanding How Users Invoke Custom Skills in order to better understand how Alexa handles user input.
I have one final obstacle in my app I'm developing with alexa-app. The value field for the singular slot I define for my tellme intent is always undefined. I'm simply trying to get Alexa to send me the raw text the user said.
I don't think it's a speech recognition problem, because this happens even when I enter plain text into simulator text edit box. I get the same result. The slot's value is always undefined.
Here is the tellme intent I define in the alexa-app initialization phase. I entered the word "test" as input into the simulator edit box:
Here is what the console log results show for the answer slot from inside the tellme intent handler:
I'm willing to make a payment via PayPal to get this resolved quickly.