question

MikeV avatar image
MikeV asked

How to Repeat, and how does the logic work?

Amazon Alexa - Repeat

Might you know how to use "Repeat?"

After I first posted, I saw the Interaction Model Builder BETA.

So I'll add the Next and Repeat... I still seek to understand how those actually work.

I'd like our fact skills to work like...

Me: "Alexa, Ask <skill name>"

Alexa: "<state a fact from the skill.> Would you like another?"

Me: "Alexa, Repeat"

Alexa: "<re-state the last fact from the skill.> Would you like another?"

Question 1:

Reference: labs here.

OK... following Lab 2 & 3...

Lab 3 talks about referencing the intent in Lab 2...

Which made me see/re-discover the Lambda function I had created (it's been a couple weeks)

My Lambda function... straight from the Fact Skill Template...

var handlers = { 'LaunchRequest': function () { this.emit('GetFact'); }, 'GetNewFactIntent': function () { this.emit('GetFact'); }, 'GetFact': function () { // Get a random space flight fact from the space facts list var factIndex = Math.floor(Math.random() * FACTS.length); var randomFact = FACTS[factIndex];

Question1:

Couldn't I reference, in the Repeat Intent, the FACTS[factIndex]?

Or are these two different things:

1) one a variable / index - var randomFact = FACTS[factIndex]

and

2) the other is an "intent": "MyNameIsIntent"

?

(also... just curious... could I rename "Math.floor(Math.random() - or is that needed to generate a random number?)

Question2.

Back to utterances... wouldn't I want something like...

RepeatFactIntent Repeat

RepeatFactIntent Alexa repeat

RepeatFactIntent Please repeat

RepeatFactIntent Alexa please repeat

RepeatFactIntent Repeat that

RepeatFactIntent Alexa repeat that

If so...

If Question1's answer is yes, you can use FACTS[factIndex]

AND

if Question2's answer is "yes, those are good utterances,

THEN

Question3:

how to link the actual get alexa to restate the fact?

(copy GetFact"

}, 'RepeatFact': function () {

// Repeat the last space flight fact from the space facts list

var randomFact = FACTS[factIndex];

// Create speech output var speechOutput = "That is worth hearing again... here is your space flight fun fact: " + randomFact;

this.emit(':tellWithCard', speechOutput, SKILL_NAME, randomFact)

Thanks,

Mike

intents
1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

MikeV avatar image MikeV commented ·

As noted, as I posted this I also saw Skill Builder Beta, and its ability to press the '+' (plus) button and add AMAZON.RepeatIntent. I added that to my skill and it quickly passed certification... and it acts no differently.

How to get Alexa to state / read a fact, and pause for the user to speak a "please repeat that" utterance?

Where do I add that block of logic?

Thanks,

Mike

0 Likes 0 ·

0 Answers