Creating a timer in Alexa Skill - alexa

I'm building an exercise skill for Alexa in Python 2.7.
I want Alexa to start a 10 second timer and say "Exercise". Once the 10 seconds is over Alexa should say "Stop".
I have tried doing this using the break SSML tag:
<speak>Exercise! <break time="10s"/> Stop </speak>
However this starts a timer/pause after "Exercise" has been said, I require the "Exercise" dictation to be inclusive of the 10 second timer.
Any ideas how I could implement this?

I think, you cannot run the lambda for more than the defined time limit.

Related

Amazon Alexa Skills - How to Add a Loop in the Skill?

I want to create a skill that's a simple game, where first the user launches the skill with its invocation name and then Alexa asks a question, "Shall I roll the dice?" If the user answers "Yes," it rolls the dice, and says the result. Then Alexa asks again, "Shall I roll the dice?" If "Yes," do the same thing. This is the main loop I'm talking about, and it'll continue until the user answers "No" or "Quit" to this question.
I just can't figure out how to add the loop, or where it should go. I've looked at tutorials and videos and whatnot and just nothing I've found mentions a loop which I find really odd. But I'm a noob at this.
Any help would be awesome. I've been wanting to do this skill for so long but just am stuck on this loop thing.
I recommend you to take some time to understand how a skill work and then I recommend you to develop a quiz skill from this doc
You will then have a better understanding of how a request is made to Alexa service and how a response is returned. The logic behind Intent, how does a slot work, ...
An Alexa Skill is like a card game. The player can select any card at any time. Each card has its own function and is triggered by a voice.
So when the skill first asks the user for Shall I roll the dice?, the user will say either yes or no.
If the user says yes, it will then go to your AMAZON.YesIntent,
If the user says no, it will then go to your AMAZON.NoIntent.
But you also need to make sure that the user can also say:
Stop > Amazon.StopIntent
Anything else, such as, cheese > FallbackIntent
By doing the quiz skill cited above, you will understand how to build your interaction model effectively.
A loop is straightforward. If the user replies yes, then in your intent handler for AMAZON.YesIntent, you will need to trigger the same function that will inject, in the response builder the prompt: Shall I roll the dice ?.
Keep in mind that a user can also ask to repeat. Imagine a skill being a personal assistant. It's not a voice mail. There are many other ways to say Shall I roll the dice? to not sound like a robot. Try implementing different response values possible to have a great customer experience overall.

What is the Alexa skill for speaking on a schedule?

I see from links like this, I can get Alexa to say arbitrary things in response to a keyword. The problem with this is I am limited to 250 characters and have no control over her timing---she just rushes everything together.
Is there a development interface that would allow me to do something like:
Say text1.
Wait 20 seconds.
Say text2.
Wait 20 seconds.
Etc?
I imagine this is the developer interface that is commonly used for things like meditation or workout apps. I really just need to know what to google to see what this interface is called and read docs---my searches for "Alexa Routines" "Alexa say things on a timer" return things about her skills called "routines" and "timers" not how to develop these.
It's called SSML: Speech Synthesis Markup Language
And you can do much more than just waiting.
<speak>
There is a three second pause here <break time="3s"/>
then the speech continues.
<break time="3s"/>
something else
</speak>
However, there is a rule where you can't allow all the break to be more than 10s.
Break tag silence can't exceed 10 seconds, including scenarios with
consecutive break tags. SSML with more than 10 seconds of silence
isn't rendered to the user.
If you need to wait more than 10sec, then you can just return your own audio.

How can Alexa recognize Stop/Cancel intent whe in ElicitSlot mode

I have an alexa skill and I'm using Dialog Management for dynamically elicit slot.
For example I have one Intent that called OrderIntent with 3 slots: drink, coffeRoast, teaType.
When a user asks for a drink for example coffee, I'm using ELICITSLOT to stay in OrderIntent and asking the user for the coffee roast or tea type.
It works great.
The problem is that when I'm waiting for the second answer from user (tea type/ coffee roast)
Alexa doesn't recognize other intents like AMAZON.StopIntent or AMAZON.CancelIntent
So when Alexa waits for the tea type/ coffee roast and the user say "stop" I get in my code the value "stop" for "teatype" instead of invoking the AMAZON.StopIntent and stop the session.
Is there any solution for that in Alexa? to use the ELICITSLOT option and still recognize the other intents?
Thanks!

can we make Alexa utter a sentence after give amount of time like an alarm?

Normally we wake up alexa and give it a command and it responds. but
can i write an Azure function with a timer trigger that calls Alexa.Net api and make alexa utter a sentence after certain instance of time. ?
In this case i will not be awaking alexa instead i want her to remind me something every hour .
can we do that ?

Using the word 'alexa' in SSML audio

I have implemented a skill that plays short SSML audio clips.
However, a few of the audio clips have alexa phrase suggestions in them.
One of the clips includes the phrase 'alexa stop'.
To my surprise it looks as if alexa 'listens' to itself in this scenario as the skill then exits instead of following the intended workflow.
Is there anything I can do about this?
You can try to mangle the word "Alexa" until it's no longer recognized--but it's possible that this will change in the future and start to be recognized again. Generally the suggestion is to not use the word "Alexa" in a response at all, what is your goal for including this phrase?

Resources