Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep an alexa skill open?

I have created a skill so that people can keep track of some state. But instead of asking alexa everytime to open the app and interact.

alexa ask grocerylist to add 2 eggs
alexa ask grocerylist to add bread

I would want to keep the grocerylist skill open so that users can interact with it until they ask it to close

alexa open grocerylist
.... 2 mins later
add 2 eggs
.... 1 min later
add bread

Is there a way to do this without having to use alexa ask grocerylist every time.

like image 780
Vishnu Avatar asked Jul 04 '16 20:07

Vishnu


People also ask

How do I keep Alexa open?

Currently, to use the Alexa App hands-free, you have to leave the screen unlocked. However, it's easy to change your settings to manually lock your device. On Android devices, go to Settings and choose Display. Tap “Screen timeout” and select “Keep screen turned on.”

Can Alexa do two Skills at once?

It's called Follow-Up Mode and it lets you give multiple commands to an Alexa smart speaker like an Echo Dot without having to say the wake word each time. (It works with at least some third-party Alexa devices as well.) Here's how to use it.

How do you set skill permissions on Alexa?

Open your skill in the developer console. Go to the Build page, and scroll down to Permissions on the lower left. Toggle the permission on for the permission that corresponds to the information your skill requires.

How do you get Alexa to guess what you're thinking?

It's essentially a form of 20 questions, where you select a character and answer a series of yes-or-no questions and Alexa tries to guess who you're thinking of. To start a game, say, "Alexa, open Akinator." The game will immediately start, and you will need to answer each question with a yes or no.


3 Answers

Of course this is possible! (But may be capped at maximum of around 8 seconds per @Bill's comment)

In your response, when calling buildSpeechletResponse, set shouldEndSession to false in order to keep the session open and keep listening for more utterances without needing to launch the skill again using "alexa ask MyApp..."

Various demos will show how to do this. e.g. See sample code here: https://github.com/amzn/alexa-skills-kit-js/blob/master/samples/savvyConsumer/src/AlexaSkill.js

like image 187
python1981 Avatar answered Oct 17 '22 12:10

python1981


This is not possible. It is a security feature so 3rd parties cannot create a skill to "listen in" on everything someone is saying. You can respond, and if you don't set the "endSession" flag, it will keep the session open. But it will only remain open for about 8 seconds. If you have set a reprompt, it will read them the reprompt at that point and stay open for another 8 seconds. So the maximum you can keep the line open for is 16 or so seconds.

like image 29
Joseph Jaquinta Avatar answered Oct 17 '22 14:10

Joseph Jaquinta


It is possible but only for a limited time.

Based on the sdk you are using you can set the flag (should end session = false). This is already done in an ask response. If you add a reprompt with that flag set then you can keep the session open until reprompt speech.

So totally intial 8 seconds until reprompt and 8 seconds again after reprompt. Total of 16 seconds.

You will have to remember the session and session variables go away after the session ends (when the blue light on alexa echo goes away). So if you want to maintain the state or the grocery list I would recommend having storage like a db. If you are using lambda to host an endpoint then it has a dynamo Db that you can use to store data.

like image 2
Guru Avatar answered Oct 17 '22 13:10

Guru