alexa-js / alexa-app

A framework for Alexa (Amazon Echo) apps using Node.js
https://www.youtube.com/watch?v=pzM4jv7k7Rg
MIT License
1.03k stars 213 forks source link

Alexa ignores schema in my alexa-app intent definition? #342

Closed roschler closed 6 years ago

roschler commented 6 years ago

I've run several tests and Alexa doesn't seem to pay attention to either the slots or the utterances I define in my alexa-app intent handlers. Instead it only responds to the slots and utterances I define in the model builder you find at this base URL:

https://developer.amazon.com/alexa/console/ask/test/

That URL goes to the model builder GUI that lets you add intents and slots via their interface. In fact, I still haven't found a place to enter a schema in JSON form. Just the GUI page linked above.

Am I simply doing something wrong or is this a new condition where you have to use their Model Builder screen now to define your schema? Note, I am receiving text from Alexa so my alexa-app handlers are being reached. I'm just still very confused about the purpose of the slots and utterances elements that I defined in the second parameter to the app.intent() call for my main intent. They don't seem to be doing anything at the moment.

dblock commented 6 years ago

I believe you always have to declare things in the schema, and the slots and utterances in the intent code are there so that a schema can be generated from that (basically trying to keep things in one place). Does this help?

roschler commented 6 years ago

@dblock Not yet, sorry. I still don't see the relation between the schema I generate directly on the Alexa Skills console (Amazon's Alexa Skills console for developers), and the schema that I put in my Node.JS app when I define alexa-app intents. As I said, when I test my Alexa Skill in the simulator, it does not seem to recognize any of the content I defined in my schema in my Node.JS app. It only recognizes the content from the schema I defined directly in the Alexa Skills console when building my interaction model.

matt-kruse commented 6 years ago

The intent and slot definitions in the code are meaningless unless you generate the schema from the code. This is done manually as part of your build process, if you have one. What you put in your code does not automatically get used as your schema.

I use the ASK CLI, so my process builds the schema from the code, writes it out to a file, then submits the new package from the CLI which automatically uses the new schema definition.

roschler commented 6 years ago

@matt-kruse Ok, now I get it. It probably wouldn't hurt to add you reply to me to the Readme where you show the sample code for an app.intent() definition, so that other developers who enter the Alexa Skills playground from the web based Alexa Skills console GUI, understand that there is an alternative workflow that uses ASK CLI and if you use the web based GUI the app.intent() schema will be ignored. I'd do it myself and make a pull request like I did for the async intent handler change suggestion I recently made, but I don't use ASK CLI and I would most likely make a mistake in my description of the alternative work flow.

Thanks for your help!

matt-kruse commented 6 years ago

Using the ASK CLI is just one way. There is some documentation there for how to generate the schema. If you are using the GUI, then the schema needs to be in a different format.

I agree that this is not very clear. I'll put it on my to-do list to add some examples.

I'm also working on templates that work easily with ASK CLI, so starting a skill is super simple and actually uploading it to run in a single command, which generates the schema and does everything for you.

roschler commented 6 years ago

@matt-kruse Sounds great, looking forward to seeing it.

dblock commented 6 years ago

Lets close this issue, I am not sure whether there's something actionable here.

roschler commented 6 years ago

@dblock Agreed and thanks for helping!