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 212 forks source link

Implement Alexa CanFulfillIntentRequest #378

Open orlylev opened 5 years ago

orlylev commented 5 years ago

Add for handler deducted for CanFulfillIntentRequest Implement default response for Can Fulfill for the intent and slots Changes to enable working without user id (as needed by AWS)

See details in Amazon documentation: https://developer.amazon.com/docs/custom-skills/implement-canfulfillintentrequest-for-name-free-interaction.html

https://developer.amazon.com/docs/custom-skills/understand-name-free-interaction-for-custom-skills.html

resolves #367

kobim commented 5 years ago

Hi @orlylev, thanks for your contribution!

According to Alexa's documents it seems like the CanFulfillIntentRequest is called along with an intent name and slot, hence a different function should be defined per each intent. Your implementation defines a single "global function" which receives all the CanFulfillIntentRequests from Alexa. Any reason you chose this implementation? (or am I missing something?)

orlylev commented 5 years ago

Hi I think it should be separate from the regular intent handler because is is relay not the business logic of implementing the intent. On the other hand looks like it is a light logic for the intent and list of slots values that can be common in many cases so I don't fill it should be a separate handler per intent. I intent to add basic common logic based on slots list that may work in most cases. Orly

On Wed, Oct 24, 2018 at 9:51 AM Kobi Meirson notifications@github.com wrote:

Hi @orlylev https://github.com/orlylev, thanks for your contribution!

According to Alexa's documents https://developer.amazon.com/docs/custom-skills/understand-name-free-interaction-for-custom-skills.html it seems like the CanFulfillIntentRequest is called along with an intent name and slot, hence a different function should be defined per each intent. Your implementation defines a single "global function" which receives all the CanFulfillIntentRequests from Alexa. Any reason you chose this implementation? (or am I missing something?)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alexa-js/alexa-app/pull/378#issuecomment-432534463, or mute the thread https://github.com/notifications/unsubscribe-auth/AQWC2j_SlISNfSNHTfEE5eyV5BO6vI1Uks5uoA39gaJpZM4XzNRa .

orlylev commented 5 years ago

I updated the example (README.md) I hope it is more clear The flow for canFulfillIntent is difference from real handling the logic of implementation so I think it should be separate The response is different and the needed logic is different It can be break into handler per intent but I feel that global handler is better in this case. It can be light common logic for many intents.