alexa-app icon indicating copy to clipboard operation
alexa-app copied to clipboard

Working example of Dialog Directive with SkillBuilder schema

Open rossthedevigner opened this issue 7 years ago • 2 comments

I've been pouring over the documentation and digging into the source for why my dialog is not replying and I think it's because I'm using the SkillBuilder.

alexaApp.intent('GetCountryIntent', {
  "dialog": {
    type: "delegate"
  },
  'slots': {},
  'utterances': []
}, (req, res) => {
  if (req.getDialog().isStarted() || req.getDialog().isInProgress()) {
    req.getDialog().handleDialogDelegation();
  }
});

The above returns "dialogState": "STARTED", but then immediately returns "dialogState": "COMPLETED"

I have my IntentSchema.json from the SkillBuilder so is there a way to inject that schema into my alexaApp.intent() or the alexaApp.express({})? I see this idea referenced here #268

The documentation mentions using ask-cli, but I'm a little lost as to how to integrate it and tie it all together. I'm not using the ask deploy command.

rossthedevigner avatar Nov 22 '17 15:11 rossthedevigner

For your second point: currently, this library is built around the idea that you'll use your JS code to generate your Alexa schema, not the other way around. e.g. alexaApp.schemas.skillBuilder() will generate an IntentSchema.json file you can drop into the skill builder, but there isn't a concept of importing a skill builder-generated JSON file into your JS app.

(I've never used dialog directives, so I'm afraid I don't particularly have anything useful to add for your main question.)

lazerwalker avatar Nov 22 '17 18:11 lazerwalker

Dialog Directives seem to be working for me using very similar code.

alexaApp.intent(
  "SetState",
  {
    dialog: { type: "delegate" },
    utterances: ["{set|change} {state|location}"]
  },
  function(req, res) {
    if (req.getDialog().isStarted() || req.getDialog().isInProgress()) {
      req.getDialog().handleDialogDelegation();
    } else if (req.getDialog().isCompleted()) {
      //do amazing skilful things with the various req.slot("SLOTNAME")
    }
  }
)

Alexa handles ensuring the slot(s) are filled as specified in the Skill Builder, and then when everything is in order, my code processes the results.

funkydan2 avatar Mar 16 '18 23:03 funkydan2