alexa-samples / skill-sample-nodejs-fact

Build An Alexa Fact Skill
Apache License 2.0
1.15k stars 1.19k forks source link

What are the AMAZON.* intents for? #62

Closed solyarisoftware closed 6 years ago

solyarisoftware commented 6 years ago

Hi

I'm an Alexa- beginner and I do not understand the behavior of this skill: (testing with https://developer.amazon.com/alexa/console/)

Alexa, open Space Facts

    Here's your fact: Neutron stars can spin at a rate of 600 rotations per second

afterward:

Alexa, start Space Facts to help

   The first person to reach space and the first person to be in orbit was Yuri Gagarin. 

again:

open Space Facts

    Here's your fact: The largest asteroid ever recorded is a mammoth piece of space rock named Ceres.

help

    For Help, please visit the help pages on the Amazon web site.

it seems to me that after GetNewFactIntent, the skill immediately "exit" and I have to invoke again the skill.

So I do not understand when events will be fired:


    'AMAZON.HelpIntent': function () {
        const speechOutput = HELP_MESSAGE;
        const reprompt = HELP_REPROMPT;

        this.response.speak(speechOutput).listen(reprompt);
        this.emit(':responseReady');
    },
    'AMAZON.CancelIntent': function () {
        this.response.speak(STOP_MESSAGE);
        this.emit(':responseReady');
    },
    'AMAZON.StopIntent': function () {
        this.response.speak(STOP_MESSAGE);
        this.emit(':responseReady');

Any idea?

BTW, In general, how can I "maintain" the session open into the skill, avoiding to exit after the first intent?

Thanks giorgio

franklin-lobb commented 6 years ago

The code you reference is from our older SDK for Node.js. I suggest updating to the newly release version, however to make that version listen for a response, you would add .listen() to the response builder as you can see in the Help Intent handler. If you do something similar in the GetNewFactIntent handler, Alexa will listen for more input.

This fact sample doesn't get into back and forth interactions. To get a better picture of how that works, I suggest checking out the trivia skill or the High Low Game.

If you have any follow up questions on this issue, please re-open the issue.

solyarisoftware commented 6 years ago

thanks for your detailed reply!