0
votes

I just got into Alexa and made the classic "Space fact" skill. However, I didnĀ“t find any resources on how to add utterances after the launch request.

An example of what I want to do: Me: Alexa open Space Facts Alexa: Saturn is big Me: next

I thought the command "next" has to be an utterance. I thought about using slots or intent confirmation, but I don't think that will work as well, will it?

What I want to achieve is that after one space fact, a user can simply say "next" or "one more" to trigger my function again.

Did I just miss something, is it not documented or is it not possible?

2

2 Answers

0
votes

The Space Fact skill has an array of facts. So all you have to do is to pick one from the array when the user says "Next" or "One more".

Use AMAZON.NextIntent
In order to capture the user's "Next" utterance, use the predefined AMAZON.NextIntent in your interaction model. So when the users say "Next" this intent will be mapped. Also add "one more" as an extra utterance for this intent.

Now, in your backend code add AMAZON.NextIntent handler and for its response get another fact from the fact array. (Add some logic so that the skill wont randomly return the same fact again. You can use sessionAttributes to keep track of read fact indexes)

Note: In order for Alexa to wait for users input after it says the first fact, you need to keep the session alive. As far as I remember the fact skill ends the session after it says the first fact.

The session is kept alive based on shouldEndSession parameter in the response. For any request, if not provided, shouldEndSession defaults to true. In your case, the response to LaunchRequest should have this shouldEndSession parameter set to false. Only by which the session remains open and users can say "next".

Read this answer to know more about how you can keep the session alive using ask-nodejs-sdk.

0
votes

Add your conversation (Utterances and responses) in the ASK developer console only under the build tab. You will need to do the following - 1. Create intent 2. Add utterances 3. Add response 4. Save and build