Software apps and online services | ||||||
| ||||||
|
Yoga Guru is a skill which will tell you how to do a yoga pose. Currently there are over 30 poses. We are continuing to add more poses.
To use this skill, enable it and ask the following question:
Alexa, Ask Yoga Guru how do I pose a cobra.
You will get a response:
Lie on your stomach. Press your palms against the floor at the level of your shoulders. Use your back muscles to raise your head and upper torso, then use arms. Straightening your arms, arch the chest section of your backbone. Look straight.
- Login to the AWS Console and click on the Lambda link. Note: ensure you are in us-east or you won't be able to use Alexa with Lambda.
- Click on the Create a Lambda Function or Get Started Now button.
- Skip the blueprint
- Name the Lambda Function "yogaGuru".
- Select the runtime as Node.js
- Create
AlexaSkill.js
,poses.js
andindex.js
files from the respective codes included in the code section below. Remember to change the App Id in index.js.
- Select the above three files and then create a zip file.
- Select Code entry type as "Upload a .ZIP file" and then upload the .zip file to the Lambda
- Keep the Handler as
index.handler
.
- Create a
basic execution role
and click create.
- Leave the Advanced settings as the defaults.
- Click "Next" and review the settings then click "Create Function"
- Click the "Event Sources" tab and select "Add event source"
- Set the Event Source type as
Alexa Skills kit
and Enable it now. Click Submit.
- Copy the ARN from the top right to be used later in the Alexa Skill Setup
- Go to the Alexa Console and click Add a New Skill.
- Set "Yoga Guru" as the skill name and "yoga guru" as the invocation name, this is what is used to activate your skill. For example you would say: "Alexa, ask the Yoga Guru."
- Select the Lambda ARN for the skill Endpoint and paste the ARN copied from above. Click Next.
- Copy the custom slot types from the List of Poses included in the code section below.
- Copy the Intent Schema from the Intent Schema include in the code section below.
- Copy the Sample Utterances from the Sample Utterances included in the code section below. Click Next.
- [optional] go back to the skill Information tab and copy the App Id. Paste the App Id into the
index.js
file for the variable APP_ID, then update the lambda source zip file with this change and upload to lambda again, this step makes sure the lambda function only serves request from authorized source.
- You are now able to start testing your sample skill! You should be able to go to the Echo webpage and see your skill enabled.
- In order to test it, try to say some of the Sample Utterances from the Examples section below.
- Your skill is now saved and once you are finished testing you can continue to publish your skill.
Follow Testing a Custom Skill.
Follow Alexa Skills Kit function testing.
Visual Interface DiagramClick here to check out the skill.
Related Links{
"intents": [
{
"intent": "PoseIntent",
"slots": [
{
"name" : "Item",
"type": "LIST_OF_POSES"
}
]
},
{
"intent": "AMAZON.HelpIntent"
},
{
"intent": "AMAZON.StopIntent"
},
{
"intent": "AMAZON.CancelIntent"
}
]
}
bridge
hare
cat
easy plow
right triangle
bound angle
garland
bow
cow
half-cobra
chair
upward bow
cobra
bikram triangle left
crane
bikram triangle right
perfect
half-boat
child
corpse
upward table
left triangle
plank
plow
greeting
eagle post right
upward plank
locust
table
east boat
PoseIntent how can I craft a {Pose}
PoseIntent how can I craft an {Pose}
PoseIntent how can I craft {Pose}
PoseIntent how can I get a {Pose}
PoseIntent how can I get an {Pose}
PoseIntent how can I get {Pose}
PoseIntent how can I make a {Pose}
PoseIntent how can I make an {Pose}
PoseIntent how can I make {Pose}
PoseIntent how can you craft a {Pose}
PoseIntent how can you craft an {Pose}
PoseIntent how can you craft {Pose}
PoseIntent how can you get a {Pose}
PoseIntent how can you get an {Pose}
PoseIntent how can you get {Pose}
PoseIntent how can you make a {Pose}
PoseIntent how can you make an {Pose}
PoseIntent how can you make {Pose}
PoseIntent how do I pose a {Pose}
PoseIntent how do I pose an {Pose}
PoseIntent how do I pose {Pose}
PoseIntent how do I craft a {Pose}
PoseIntent how do I craft an {Pose}
PoseIntent how do I craft {Pose}
PoseIntent how do I get a {Pose}
PoseIntent how do I get an {Pose}
PoseIntent how do I get {Pose}
PoseIntent how do I make a {Pose}
PoseIntent how do I make an {Pose}
PoseIntent how do I make {Pose}
PoseIntent how do you craft a {Pose}
PoseIntent how do you craft an {Pose}
PoseIntent how do you craft {Pose}
PoseIntent how do you get a {Pose}
PoseIntent how do you get an {Pose}
PoseIntent how do you get {Pose}
PoseIntent how do you make a {Pose}
PoseIntent how do you make an {Pose}
PoseIntent how do you make {Pose}
PoseIntent how is a {Pose} crafted
PoseIntent how is a {Pose} made
PoseIntent how is an {Pose} crafted
PoseIntent how is an {Pose} made
PoseIntent how is {Pose} crafted
PoseIntent how is {Pose} made
PoseIntent how {Pose} is made
PoseIntent pose for a {Pose}
PoseIntent pose for an {Pose}
PoseIntent pose for {Pose}
PoseIntent poses for a {Pose}
PoseIntent poses for an {Pose}
PoseIntent poses for {Pose}
PoseIntent what is in a {Pose}
PoseIntent what is in an {Pose}
PoseIntent what is in {Pose}
PoseIntent what is the pose for a {Pose}
PoseIntent what is the pose for an {Pose}
PoseIntent what is the pose for {Pose}
PoseIntent what's in a {Pose}
PoseIntent what's in an {Pose}
PoseIntent what's in {Pose}
PoseIntent what's the pose for a {Pose}
PoseIntent what's the pose for an {Pose}
PoseIntent what's the pose for {Pose}
PoseIntent how to craft {Pose}
PoseIntent how to craft a {Pose}
PoseIntent how to craft an {Pose}
PoseIntent how to make a {Pose} pose
PoseIntent how to make an {Pose} pose
PoseIntent how to make {Pose} pose
PoseIntent how to get a {Pose} pose
PoseIntent how to get an {Pose} pose
PoseIntent how to get {Pose} pose
/**
Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';
function AlexaSkill(appId) {
this._appId = appId;
}
AlexaSkill.speechOutputType = {
PLAIN_TEXT: 'PlainText',
SSML: 'SSML'
}
AlexaSkill.prototype.requestHandlers = {
LaunchRequest: function (event, context, response) {
this.eventHandlers.onLaunch.call(this, event.request, event.session, response);
},
IntentRequest: function (event, context, response) {
this.eventHandlers.onIntent.call(this, event.request, event.session, response);
},
SessionEndedRequest: function (event, context) {
this.eventHandlers.onSessionEnded(event.request, event.session);
context.succeed();
}
};
/**
* Override any of the eventHandlers as needed
*/
AlexaSkill.prototype.eventHandlers = {
/**
* Called when the session starts.
* Subclasses could have overriden this function to open any necessary resources.
*/
onSessionStarted: function (sessionStartedRequest, session) {
},
/**
* Called when the user invokes the skill without specifying what they want.
* The subclass must override this function and provide feedback to the user.
*/
onLaunch: function (launchRequest, session, response) {
throw "onLaunch should be overriden by subclass";
},
/**
* Called when the user specifies an intent.
*/
onIntent: function (intentRequest, session, response) {
var intent = intentRequest.intent,
intentName = intentRequest.intent.name,
intentHandler = this.intentHandlers[intentName];
if (intentHandler) {
console.log('dispatch intent = ' + intentName);
intentHandler.call(this, intent, session, response);
} else {
throw 'Unsupported intent = ' + intentName;
}
},
/**
* Called when the user ends the session.
* Subclasses could have overriden this function to close any open resources.
*/
onSessionEnded: function (sessionEndedRequest, session) {
}
};
/**
* Subclasses should override the intentHandlers with the functions to handle specific intents.
*/
AlexaSkill.prototype.intentHandlers = {};
AlexaSkill.prototype.execute = function (event, context) {
try {
console.log("session applicationId: " + event.session.application.applicationId);
// Validate that this request originated from authorized source.
if (this._appId && event.session.application.applicationId !== this._appId) {
console.log("The applicationIds don't match : " + event.session.application.applicationId + " and "
+ this._appId);
throw "Invalid applicationId";
}
if (!event.session.attributes) {
event.session.attributes = {};
}
if (event.session.new) {
this.eventHandlers.onSessionStarted(event.request, event.session);
}
// Route the request to the proper handler which may have been overriden.
var requestHandler = this.requestHandlers[event.request.type];
requestHandler.call(this, event, context, new Response(context, event.session));
} catch (e) {
console.log("Unexpected exception " + e);
context.fail(e);
}
};
var Response = function (context, session) {
this._context = context;
this._session = session;
};
function createSpeechObject(optionsParam) {
if (optionsParam && optionsParam.type === 'SSML') {
return {
type: optionsParam.type,
ssml: optionsParam.speech
};
} else {
return {
type: optionsParam.type || 'PlainText',
text: optionsParam.speech || optionsParam
}
}
}
Response.prototype = (function () {
var buildSpeechletResponse = function (options) {
var alexaResponse = {
outputSpeech: createSpeechObject(options.output),
shouldEndSession: options.shouldEndSession
};
if (options.reprompt) {
alexaResponse.reprompt = {
outputSpeech: createSpeechObject(options.reprompt)
};
}
if (options.cardTitle && options.cardContent) {
alexaResponse.card = {
type: "Simple",
title: options.cardTitle,
content: options.cardContent
};
}
var returnResult = {
version: '1.0',
response: alexaResponse
};
if (options.session && options.session.attributes) {
returnResult.sessionAttributes = options.session.attributes;
}
return returnResult;
};
return {
tell: function (speechOutput) {
this._context.succeed(buildSpeechletResponse({
session: this._session,
output: speechOutput,
shouldEndSession: true
}));
},
tellWithCard: function (speechOutput, cardTitle, cardContent) {
this._context.succeed(buildSpeechletResponse({
session: this._session,
output: speechOutput,
cardTitle: cardTitle,
cardContent: cardContent,
shouldEndSession: true
}));
},
ask: function (speechOutput, repromptSpeech) {
this._context.succeed(buildSpeechletResponse({
session: this._session,
output: speechOutput,
reprompt: repromptSpeech,
shouldEndSession: false
}));
},
askWithCard: function (speechOutput, repromptSpeech, cardTitle, cardContent) {
this._context.succeed(buildSpeechletResponse({
session: this._session,
output: speechOutput,
reprompt: repromptSpeech,
cardTitle: cardTitle,
cardContent: cardContent,
shouldEndSession: false
}));
}
};
})();
module.exports = AlexaSkill;
/**
Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
/**
* This sample shows how to create a Lambda function for handling Alexa Skill requests that:
*
* - Custom slot type: demonstrates using custom slot types to handle a finite set of known values
*
* Examples:
* One-shot model:
* User: "Alexa, ask Minecraft Helper how to make paper."
* Alexa: "(reads back pose for cobra)"
*/
'use strict';
var AlexaSkill = require('./AlexaSkill'),
poses = require('./poses');
var APP_ID = "amzn1.echo-sdk-ams.app.a067d926-7fcc-4866-a663-a16ba4d1ee6e"; // undefined; //replace with 'amzn1.echo-sdk-ams.app.[your-unique-value-here]';
/**
* YogaHowTo is a child of AlexaSkill.
* To read more about inheritance in JavaScript, see the link below.
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript#Inheritance
*/
var YogaHowTo = function () {
AlexaSkill.call(this, APP_ID);
};
// Extend AlexaSkill
YogaHowTo.prototype = Object.create(AlexaSkill.prototype);
YogaHowTo.prototype.constructor = YogaHowTo;
YogaHowTo.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) {
var speechText = "Welcome to the Yoga How To. You can ask a question like, how do i make a cobra pose? ... Now, what can I help you with.";
// If the user either does not reply to the welcome message or says something that is not
// understood, they will be prompted again with this text.
var repromptText = "For instructions on what you can say, please say help me.";
response.ask(speechText, repromptText);
};
YogaHowTo.prototype.intentHandlers = {
"PoseIntent": function (intent, session, response) {
var poseSlot = intent.slots.Pose,
poseName;
if (poseSlot && poseSlot.value){
poseName = poseSlot.value.toLowerCase();
}
var cardTitle = "Pose for " + poseName,
pose = poses[poseName],
speechOutput,
repromptOutput;
if (pose) {
speechOutput = {
speech: pose,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.tellWithCard(speechOutput, cardTitle, pose);
} else {
var speech;
if (poseName) {
speech = "I'm sorry, I currently do not know the pose for " + poseName + ". What else can I help with?";
} else {
speech = "I'm sorry, I currently do not know that pose. What else can I help with?";
}
speechOutput = {
speech: speech,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
repromptOutput = {
speech: "What else can I help with?",
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.ask(speechOutput, repromptOutput);
}
},
"AMAZON.StopIntent": function (intent, session, response) {
var speechOutput = "Thanks for using Yoga How To. Peace Be With you. Until next time.";
response.tell(speechOutput);
},
"AMAZON.CancelIntent": function (intent, session, response) {
var speechOutput = "Thanks for using Yoga How To. Peace Be With you. Until next time.";
response.tell(speechOutput);
},
"AMAZON.HelpIntent": function (intent, session, response) {
var speechText = "You can ask questions about yoga such as, how do i make a cobra pose, or, you can say exit... Now, what can I help you with?";
var repromptText = "You can say things like, how do i make a cobra pose, or you can say exit... Now, what can I help you with?";
var speechOutput = {
speech: speechText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.ask(speechOutput, repromptOutput);
}
};
exports.handler = function (event, context) {
var yogaHowTo = new YogaHowTo();
yogaHowTo.execute(event, context);
};
module.exports = {
"bridge": "Lying on your back, bend your legs and put your feet at your hips’ width. Lift your pelvis and hips, trying to move on to your shoulders. Put your arms along your legs with your palms facing down, or clasp your hands under your body on the floor.",
"hare": "Lower your head as you sit on your heels. Stretch your arms forward on the floor. Relax.",
"cat": "Stand on all fours. Put your hands and knees at your hips' width. Round your back and hang your head down.",
"easy plow": "Lie on your back. Bend your legs. Keep your legs together, your feet on the floor. Lift your feet and pelvis from the mat (you can help with your hands) and lower your knees on your forehead. You can press your palms against your back or clasp your hands and lower them on the mat behind your back. Return slowly rolling your backbone back on the mat.",
"right triangle": "Put your feet at the length of your leg. Stretch your arms to your sides. Rotate your right foot 90 degrees, left foot about 15 degrees to the right. Start stretching to the right. Put your right hand on the right leg or floor as you reach your edge with a straight back. Try not to arch your torso. Keep your legs straight. Raise your left hand. Try to look up at your palm.",
"bound angle": "Sit with your legs straight out in front of you. Bend your knees and pull your heels toward your pelvis. Lower your knees out to the sides and press your soles together. Bring your heels as close to your pelvis as you can. Grasp both feet with your hands. Keep your back straight.",
"garland": "Stand with your feet a bit wider apart than at your hips' width. Squat down. Keep your heels on the floor. Push your elbows against your thighs and shins. Join your hands in Namaste at your chest level. Look straight.",
"bow": "Lie on your stomach. Keep your legs at your hips’ width. Bend both knees. Raise your head and upper torso. Stretch your arms towards your feet and try to grab your ankles. Helping with your hands, lift your thighs from the mat and try to draw yourself as a bow. Extend your legs and head up. Look straight.",
"cow": "Take the table pose. Lift your pelvis and chest toward the ceiling, so that your stomach moves toward the floor. Lift your head.",
"half-cobra": "Lie on your stomach. Use your back muscles to raise your head and upper torso. Press your elbows against the floor. Arch the chest section of your backbone. Look straight.",
"chair": "Stand up straight, legs together. Raise your arms through your sides and join your palms. Bend your knees as much as possible, keeping your heels on the floor. Slightly arch your back.",
"upward bow": "Lie on your back. Firmly press your feet against the floor. Press your hands against the floor at the level of your ears. Push with your hands and feet lifting your pelvis and thighs. Put the crown of your head on the mat. Move some of the weight on your hands. Raise your head and let it hang freely. As you go back, go down on your head first.",
"cobra": "Lie on your stomach. Press your palms against the floor at the level of your shoulders. Use your back muscles to raise your head and upper torso, then use arms. Straightening your arms, arch the chest section of your backbone. Look straight.",
"bikram triangle left": "Stand up straight. Step to the left with your left foot. Rotate your left foot 90 degrees and your right foot about 15 degrees to the left. Bend your left leg 90 degrees. Stretch your arms to your sides, palms up. Bend your torso to the left with your left side facing your left thigh. Stretch your left arm down and right arm up.",
"crane": "Squat down. Put your palms on the floor and straighten your legs. Press your knees against your shoulder bone closer to your armpits. Move your weight forward to your arms and try to lift your feet from the floor. Balance on your hands.",
"bikram triangle right": "Stand up straight. Step to the right with your right foot. Rotate your right foot 90 degrees and your left foot about 15 degrees to the right. Bend your right leg 90 degrees. Stretch your arms to your sides, palms up. Bend your torso to the right, with your right side facing your right thigh. Stretch your right arm down and left arm up.",
"perfect": "Sit with your legs stretched in front of you. Bend your left knee and place your left heel next to your perineum. Bend your right knee and place it over your left heel. Sit straight, relax your shoulders and place your hands facing up on your knees.",
"half-boat": "Sit straight, bend your legs. Press your hands against the floor behind your back and raise your half-bent legs with your shins parallel to the floor. Balancing on your pelvic bones, straighten your arms in front of you at your shins' level. Try to keep your back straight.",
"child": "Sitting on your heels, lower your head on the mat. Put your arms alongside your legs or under your forehead. Relax.",
"corpse": "Lie on your back. Stretch your backbone on the floor, helping with your hands. Straighten your legs, your toes relaxed and pointing outward. Put your arms along your torso with your palms up, your shoulders pressed to the floor. Close your eyes and relax. Try to calm your breath and mind as much as you can.",
"upward table": "Sit down straight with your legs bent. Press your palms against the floor behind your back. Pushing with your hands, raise your pelvis so that your thighs and back are parallel to the floor.",
"left triangle": "Put your feet at the length of your leg. Stretch your arms to your sides. Rotate your left foot 90 degrees, right foot about 15 degrees to the left. Start stretching to the left. Put your left hand on the left leg or floor as you reach your edge with a straight back. Try not to arch your torso. Keep your legs straight. Raise your right hand. Try to look up at your palm.",
"plank": "Take the table pose. Move your thighs backward and straighten your legs. Keeping your arms straight, make your head, torso and legs form one line.",
"plow": "Lie on your back. Lift your legs and slowly move them behind your head helping with your hands. Keep your legs straight. Press your hands against your back. Move your arms behind your back, clasp your hands trying to put them down on the mat. Return to the initial position very softly rolling down on your back.",
"greeting": "Stand up straight with your legs together. Raise your arms, bending them and joining your palms at the chest level. This is a sign of greeting from heart to heart.",
"eagle post right": "Stand up straight. Bend your knees slightly, lift your left foot and cross your left thigh over the right. Hook the top of the left foot behind the right calf. Stretch your arms to the sides parallel to the floor. Bend your elbows and raise your forearms perpendicular to the floor. Put your right elbow over your left elbow and press your palms together. Look straight.",
"upward plank": "Sit straight, your legs bent. Move your hands behind your back and press your palms down against the floor, your fingers looking at you. Lift your pelvis and take the table position. Straighten your legs. Drive your toes towards the floor. Press your shoulder blades against your back. Look up.",
"locust": "Lie on your stomach. Press your chin against the mat. Keep your hands in fists with your thumbs inside. Put your straight arms under your thighs. Making an effort with your back muscles and supporting with your fists from below, raise both your legs up. Keep this position without holding your breath.",
"table": "Stand on all fours. Put your hands and knees at your hips' width.",
"east boat": "Sit straight with your legs bent and feet on the floor at your hips' width. Press your hands against the floor behind your back. Balancing on your pelvic bones, straighten your arms in front of you parallel to the floor. Try to keep your back straight.",
"left triangle": "Put your feet at the length of your leg. Stretch your arms to your sides. Rotate your left foot 90 degrees, right foot about 15 degrees to the left. Start stretching to the left. Put your left hand on the left leg or floor as you reach your edge with a straight back. Try not to arch your torso. Keep your legs straight. Raise your right hand. Try to look up at your palm.",
};
Comments