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

Example of waterfall or slot filling #231

Open McGern opened 7 years ago

McGern commented 7 years ago

Hi,

Sorry if this has already been covered, but I didn't find it. Is there an example of using alexa-app for multi step dialogs or filling missing slots?

Thanks, Jarrod

ericblade commented 7 years ago

Unfortunately, I can't share the code that I've got considering that it's for my company, but I can probably offer some advice:

Use session.set() to store the user's responses via intents or slots into the user's session data. Keep asking questions until you have all the data you need. Then handle it. :-) Does that make sense?

Alternatively, there is beta version of handling that kinda stuff in the (amazon side) API now, but I'm not real familiar with how it works.

timoa commented 7 years ago

Thanks @ericblade for your reply but my current issue is how to reply on the same Intent with an answer that doesn't match it. Example:

findHolidayIntent {to}, {from} & {when} are required

find me holidays to {to} from {from} around the {when} find me holidays to {to} from {from} find me holidays to {to}

User: find me holidays to {to} => findHolidaysIntent => response.say("from which city?") + session.set("to",{to}) Alexa: From which city? User: {from} => No intent match because it can be any slots and the conversation stop...

Amazon created functions to handle that on the Alexa side with

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/ask-define-the-vui-with-gui#define-dialog

My model use required slots with the right utterances but it doesn't work if you don't use the Dialog directives from the Alexa SDK.

Any plan to integrate it instead of DIY on the app side?

dblock commented 7 years ago

@timoa No such plans, pull requests welcome!

Dens49 commented 7 years ago

I am currently using a workaround which adds the necessary directive with the updatedIntent object to the response.

However I'm not sure how to integrate that into alexa-app, I have no idea how to test it and I'm also unfamiliar with TS. Any suggestions on how to integrate that functionality?

rossthedevigner commented 6 years ago

Is delegate the only supported type?

  "dialog": {
    type: "delegate"
  },
iamkoch commented 6 years ago

@Dens49 I realise it was a year ago, but are you able to share how you did this? Or can this now be done in the latest version of the package?