Software apps and online services | ||||||
| ||||||
| ||||||
|
Skill ID number
amzn1.ask.skill.621a1632-300e-456d-ac6a-71b4c9f70074
Story: Motivation
At Beachbody, we want to help people achieve their fitness goals.
With Alexa, fitness can really become integrated part of user's lifestyles as opposed to a dedicated block of time in gym/studio etc.
We plan to achieve this by providing information about workout programs, guiding them through the program and nutrition guides, enabling them to follow a schedule, rewarding when fitness goals achieved and so on. We have developed a voice-based virtual fitness assistant which will assist in every aspect of fitness.
This project is first step towards building a fully-aware fitness assistant which understands user preferences, observes user behavior and combines this knowledge with in-house fitness experts to provide meaningful insights into a person's health.
Overview: Technology
In order to recommend workout programs, account must be linked with Beachbody. Once linked, the lambda function connects to Beachbody's backend systems to provide rich interactive experience.
All recommendations are powered by Beachbody's backend system which leverages the knowledge of fitness experts. This is then made available via a micro-service specific to recommendations. Additionally, all program/trainer metadata, nutrition guides and recipe information is fetched from various other micro-service APIs.
The video completion events are captured and user's profile s updated. This syncs the data when Alexa is invoked next time, as behind the scenes the lambda function talks to the updated profile data. We used SNS for event communication.
/**
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 threcipense 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.
*/
/**
* Implement virtual fitness assistant
*
*/
/**
* App ID for the skill
*/
var APP_ID = "amzn1.ask.skill.621a1632-300e-456d-ac6a-71b4c9f70074"; //replace with 'amzn1.echo-sdk-ams.app.[your-unique-value-here]';
var https = require('https');
var http = require('http');
var util = require('util');
/**
* The AlexaSkill Module that has the AlexaSkill prototype and helper functions
*/
var AlexaSkill = require('./AlexaSkill');
/**
* URL prefix to download content data
*/
var urlPrefix = 'content-dom-origin.api.beachbodyondemand.com';
/**
* Variable defining number of events to be read at one time
*/
var paginationSize = 1;
/**
* Variable defining the length of the delimiter between events
*/
var delimiterSize = 2;
/**
* BBskill is a child of AlexaSkill.
* To read more about inheritance in JavaScript, see the link below.
*
*/
var BBskill = function() {
AlexaSkill.call(this, APP_ID);
};
// Extend AlexaSkill
BBskill.prototype = Object.create(AlexaSkill.prototype);
BBskill.prototype.constructor = BBskill;
BBskill.prototype.eventHandlers.onSessionStarted = function (sessionStartedRequest, session) {
console.log("BBskill onSessionStarted requestId: " + sessionStartedRequest.requestId
+ ", sessionId: " + session.sessionId);
// any session init logic would go here
};
BBskill.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) {
console.log("BBskill onLaunch requestId: " + launchRequest.requestId + ", sessionId: " + session.sessionId);
getWelcomeResponse(response);
};
BBskill.prototype.eventHandlers.onSessionEnded = function (sessionEndedRequest, session) {
console.log("onSessionEnded requestId: " + sessionEndedRequest.requestId
+ ", sessionId: " + session.sessionId);
};
/********* Intent Handlers ***************/
BBskill.prototype.intentHandlers = {
"GetFirstEventIntent": function (intent, session, response) {
handleFirstEventRequest(intent, session, response);
},
"GetDetailEventIntent": function (intent, session, response) {
handleDetailEventRequest(intent, session, response);
},
"GetWorkoutSummaryIntent": function (intent, session, response) {
handleWorkoutSummaryRequest(intent, session, response);
},
"GetProgramDetailIntent": function (intent, session, response) {
handleProgramDetailRequest(intent, session, response);
},
"NutritionIntent": function (intent, session, response) {
handleNutritionRequest(intent, session, response);
},
"OnboardingIntent": function (intent, session, response) {
handleOnboardingRequest(intent, session, response);
},
"GoalIntent": function (intent, session, response) {
handleGoalRequest(intent, session, response);
},
"VideoIntent": function (intent, session, response) {
handleVideoRequest(intent, session, response);
},
"GetNextEventIntent": function (intent, session, response) {
if(session.attributes.trainer) {
getAllContestantsData(function (contestants) {
session.attributes.text = contestants;
handleNextEventRequest(intent, session, response)
});
session.attributes.trainer = false;
}
if(session.attributes.program) {
handleProgramDetailRequest(intent, session, response);
session.attributes.program = false;
}
},
"AMAZON.HelpIntent": function (intent, session, response) {
var speechText = "With Beach body you can ask latest information for their twenties show. " +
"For example, to start, you could say, Beach body tell me about twenties. ";
var repromptText = "Do you wish to know about Beach body Twenties";
var speechOutput = {
speech: speechText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.ask(speechOutput, repromptOutput);
},
"AMAZON.StopIntent": function (intent, session, response) {
var speechOutput = {
speech: "<speak>You can learn more at beach body on demand dot com.<break time = \"0.3s\"/> Goodbye.</speak>",
type: AlexaSkill.speechOutputType.SSML
};
response.tell(speechOutput);
},
"AMAZON.CancelIntent": function (intent, session, response) {
var speechOutput = {
speech: "<speak>You can learn more at beach body on demand dot com.<break time = \"0.3s\"/> Goodbye.</speak>",
type: AlexaSkill.speechOutputType.SSML
};
response.tell(speechOutput);
}
};
/**
* Function to handle welcome intent
*/
function getWelcomeResponse(response) {
// If we wanted to initialize the session to have some attributes we could add those here.
var cardTitle = "Beachbody ";
var repromptText = "With Beach body you can ask latest information for their twenties show.";
var speechText = "<p>Beach body Twenties.";
var cardOutput = "Beachbody. Ask alexa more about Twenties Show";
// 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 speechOutput = {
speech: "<speak>" + speechText + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardOutput);
}
/**
* Function to handle next-level interaction intents
*/
function handleDetailEventRequest(intent, session, response) {
var contestantName = intent.slots.contestant.value;
var cardTitle = "Beachbody Twenties Contestant" + contestantName;
var repromptText = "Do you want to know more about other contestants?";
var prefixContent = "<p> Beach body Twenties Contestant "+contestantName+"</p>";
var query = "v2/trainers?trainerType=contestant&displayName="+contestantName;
getContentAPIData(query, function (data) {
var cardContent = data;
if (!data) {
speechText = "I can't find information on "+contestantName+ "<break time = \"0.5s\"/> Do you want to know more about other contestants?";
cardContent = "Detailed information available at www.beachbodyondemand.com/the20s/trainers";
}
data = data.replace(/Beachbody/i, "Beach body");
var speechOutput = {
speech: "<speak>" + prefixContent + data + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardContent);
});
}
/**
* Function to handle show intent
*/
function handleFirstEventRequest(intent, session, response) {
var cardTitle = "Beachbody Twenties Show";
var repromptText = "Do you want to know more about Twenties contestants?";
var prefixContent = "<p> Beach body Twenties </p>";
var suffixContent = "<break time = \"0.3s\"/>Do you want to know more about twenties contestants?";
getContentAPIData("shows/the-20s", function (showData) {
var cardContent = showData;
showData = showData.replace(/Beachbody/i, "Beach body");
var speechOutput = {
speech: "<speak>" + prefixContent + showData + suffixContent + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
session.attributes.trainer=true;
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardContent);
});
}
/**
* Function to handle goal intent
*/
function handleGoalRequest(intent, session, response) {
var cardTitle = "Set Calorie Burnout Preference";
var repromptText = "Set Calorie Burnout Preference";
var content = "<p> Okay, your daily calorie goal is set.</p>";
var speechOutput = {
speech: "<speak>" + content + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
session.attributes.trainer=true;
response.askWithCard(speechOutput, repromptOutput, cardTitle, content);
}
/**
* Function to handle video play intent
*/
function handleVideoRequest(intent, session, response) {
var cardTitle = "Congrats!";
var repromptText = "To know about shake recipe say Beach body tell me about available Shakeolojee shakes";
var content = "<p> <break time = \"1s\"/>Okay. <break time = \"9s\"/>You just finished CIZE IT UP - Full Out from CIZE.<break time = \"0.3s\"/> "+
"Great Job!. Based on your heart rate throughout the workout, you burned 250 calories approximately <break time = \"0.3s\"/>"+
"You are ahead of your daily calorie schedule! <break time = \"0.5s\"/>You can try a Shakeolojee shake after this workout. "+
"Just say Beach body tell me about available Shakeolojee shakes</p>";
var speechOutput = {
speech: "<speak>" + content + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.askWithCard(speechOutput, repromptOutput, cardTitle, content);
}
/**
* Function to handle trainer information intent in a loop
*/
function handleNextEventRequest(intent, session, response) {
var cardTitle = "More About Beachbody contestants.",
speechText = "",
cardContent = "",
repromptText = "Do you want to know more about a particular contestant, if yes please say Beach body, tell me about twenties contestant Bonnie.",
sessionAttributes = session.attributes,
result = sessionAttributes.text,
i;
if(!sessionAttributes.index) {
index = 1;
}
if (!result) {
speechText = "There are no more trainers. You can watch latest episodes at beach body on demand dot com slash the twenties.<break time = \"0.3s\"/> Goodbye.";
cardContent = "There are no more trainers. Watch latest episodes at www.beachbodyondemand.com/the20s";
} else if (index >= result.length) {
speechText = "There are no more trainers. You can watch latest episodes at beach body on demand dot com slash the twenties.<break time = \"0.3s\"/> Goodbye.";
cardContent = "There are no more trainers. Watch latest episodes at www.beachbodyondemand.com/the20s"
} else {
trainerData = "Bio for Beach body trainer "+result[index]['name']+"<break time = \"0.4s\"/>" +
result[index]['bio'];
speechText = speechText + "<p>" + trainerData + "</p> ";
// Maybe change this
cardContent = cardContent + result[index]['bio'] + " ";
index++;
if (index < result.length) {
speechText = speechText + " <break time = \"0.3s\"/> Wanna know about next trainer?";
cardContent = cardContent + "Wanna know about next trainer?";
}
sessionAttributes.index=index;
sessionAttributes.text=result;
session.attributes = sessionAttributes;
}
var speechOutput = {
speech: "<speak>" + speechText + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardContent);
}
/**
* Function to handle workout summary intent
*/
function handleWorkoutSummaryRequest(intent, session, response) {
var cardTitle = "Amrita, Here is your Workout Summary";
var repromptText = "To set daily goals just say beach body set my daily calorie goal to 200.";
var prefixContent = "<p>Amritaa, Here is your Workout Summary</p>";
var cardContent = "";
var options = {
"method": "GET",
"hostname": "audience-dom.api.beachbodyondemand.com",
"port": null,
"path": "/personalization/recognition?email=jaina123@beachbody.com"
};
var req = http.request(options, function (res) {
var body = '';
res.on("data", function (chunk) {
body += chunk;
});
res.on("end", function () {
if (!body) {
speechText = "Ready to transform your life? Get started with beach body programs, to learn more say tell me about beach body programs";
cardContent = "Ready to transform your life? Get started with beach body programs, detailed information available at http://club.teambeachbody.com";
} else {
body = body.replace("\n","\\n");
rawData = JSON.parse(body);
speechText = "You did total of " + rawData.workout.completed_workouts + " " + rawData.workout.label;
var nextPrompt = "Next workout on your calendar is, CIZE IT UP - Full Out from CIZE";
session.attributes.greenberry=true;
speechText += ". Your last workout was " + rawData.lastworkout.workoutTitle + " from " + rawData.lastworkout.programName+"<break time = \"0.5s\"/>" ;
cardContent = speechText;
}
var speechOutput = {
speech: "<speak>" + prefixContent + speechText + nextPrompt + "<break time = \"1s\"/>" + repromptText+ "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
session.attributes.program=true;
session.attributes.programId=rawData.lastworkout.brandCode;
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardContent);
});
}).on('error', function (e) {
console.log("Got error: ", e);
});
req.end();
}
/**
* Function to handle onboarding intent
*/
function handleOnboardingRequest(intent, session, response) {
var question1 = "Sure, I would like to know three things about you, so I can recommend the best program for your needs.<break time = \"0.5s\"/> " + "Which type of exercise do you enjoy the most? Yogaa, cardio, muscle building or dancing?<break time = \"0.5s\"/>";
var question2 = "Sounds good, How long would you like to workout today? <break time = \"0.5s\"/> 15 minutes, 30 minutes or 60 minutes?";
var question3 = "Okay, Final question, Would you say you are very fit, somewhat fit or just starting out?";
var question4 = "Great, Finding the best matching workout program for you <break time = \"1s\"/>";
var nextQuestion = question1;
console.log(intent.slots);
if(intent.slots) {
if (intent.slots.programType.value) {
var answer1 = intent.slots.programType.value;
var nextQuestion = question2;
}
if (intent.slots.programDuration.value) {
var answer2 = intent.slots.programDuration.value;
var nextQuestion = question3;
}
if (intent.slots.fitness.value) {
var answer3 = intent.slots.fitness.value;
var nextQuestion = question4;
}
}
var cardTitle = "Beachbody Workout Program Recommendation";
var repromptText = "Would you like to play this workout?";
if (nextQuestion == question4) {
getOnboardingResults(function(data){
var speechText = question4 + "The program that best matches your preferences is " + "<break time = \"0.3s\"/>" + data.topRecommendations.programTitle + "by " + data.topRecommendations.trainerName +".";
speechText += "<break time = \"0.5s\"/>" + data.topRecommendations.longDescription +"<break time = \"0.5s\"/>";
speechText = speechText.replace(/Beachbody/i, "Beach body");
cardTitle += data.topRecommendations.programTitle;
var speechOutput = {
speech: "<speak>" + speechText + " <break time = \"0.8s\"/>" + repromptText+ "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardContent);
});
} else {
var prefixContent = nextQuestion;
var cardContent = nextQuestion;
var speechOutput = {
speech: "<speak>" + prefixContent + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardContent);
}
}
/**
* Function to handle program details intent
*/
function handleProgramDetailRequest(intent, session, response) {
var cardTitle = "Beachbody Program ";
var repromptText = "You can get details for other workout programs too! for example, you can say Beach body, tell me about workout program country heat";
var prefixContent = "<p>Beach body Program</p>";
var cardContent = "";
var programMap = '{"size":"cize","21 day fix":"21d","21 day fix extreme":"21e","22 minute hard corps":"22hc","body beast":"be","cize":"cz","country heat":"ch","focus t25":"t25","hammer and chisel":"mhc","insanity max 30":"im","autumn calabrese exclusives":"ytac","p90":"p2","tony horton exclusives":"ytth","piyo":"bbpiyo","sagi kalev exclusives":"ytsk","challenge du jour":"challenge-du-jour","master trainers":"mt","the 20s":"20s","active maternity":"acam","insanity":"san","brazil butt lift carnivale":"car","brazil butt lift master":"bblm","brazil butt lift":"bbl","turbo fire":"tr","p90x3":"x3","p90x2":"x2","p90x":"p90x","chalean extreme":"ce","hip hop abs":"hha","10 minute trainer":"tm","insanity asylum vol 1":"asy","insanity asylum vol 2":"a2","slim in 6":"sl6","rockin body":"rb","rev abs":"ra","tai cheng":"tc","turbo jam":"tj","yoga booty ballet":"ybb","total body solution":"tb","power half hour":"phh","kathy smith project you type 2":"ks","great body guaranteed":"gbg","power 90":"p90","ho ala ke kino":"hoa"}';
var speechOutput = {
speech: "<speak>" + "21 Day Fix—Simple Fitness. Simple Eating. Fast Results. In just 21 days." + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardContent);
//});
}
/**
* Function to handle contestant details intent
*/
function getAllContestantsData(eventCallback) {
var options = {
"method": "GET",
"hostname": urlPrefix,
"port": null,
"path": "/v2/trainers?trainerType=contestant",
"headers": {
"content-type": "application/json",
"accept": "application/json"
}
};
var contestants=[];
var req = http.request(options, function (res) {
var body = '';
res.on("data", function (chunk) {
body += chunk;
});
res.on("end", function () {
//console.log(body.toString());
body = body.replace("\n","\\n");
var rawData = JSON.parse(body).items;
var arrayLength = rawData.length;
for (var i = 0; i < arrayLength; i++) {
contestants[i]=[];
contestants[i]['name']= rawData[i]['displayName'];
contestants[i]['bio']= rawData[i]['description']['raw'];
}
eventCallback(contestants);
});
}).on('error', function (e) {
console.log("Got error: ", e);
});
req.end();
}
/**
* Function to handle shake recipe intent
*/
function handleNutritionRequest(intent, session, response) {
/* This data is not readily available, generated by scraping website*/
var recipes = ["<p>Spiced Orange Blossom,</p> You need, 1 serving of Vanilla Shakeolojee, 1 cup water, 4 tea spoon orange herbal cooled tea and half tea spoon ground cinnamon.",
"<p>Vanilla Chai,</p> You need, 1 serving of Vanilla Shakeolojee, 1 cup brewed Chai tea (cooled), 1 tea spoon raw honey and 1 dash ground allspice.",
"<p>Breakfast at Hazels, </p> 1 serving of Chocolate Shakeolojee, 1 tea spoon hazelnut extract and 1 cup water.",
"<p>Pumpkin Pie,</p> 1 serving of Chocolate Shakeolojee, half cup unsweetened canned pumpkin, half tea spoon cinnamon, half tea spoon nutmeg and1 cup skim (nonfat) milk.",
"<p>Strawberry Lemonade,</p> 1 serving of Strawberry Shakeolojee, 1 cup water, 2 Table spoon fresh lemon juice, 1 tea spoon pure maple syrup and finally 1 cup ice.",
"<p>Strawberry Garden,</p> 1 serving of Strawberry Shakeolojee,1 cup unsweetened almond milk,1 cup fresh spinach, coarsely chopped,2 table spoon. fresh lime juice,1 tea spoon raw honey and finally 1 cup ice",
"<p>Mohito Lemonade,</p>1 serving of Greenberry Shakeolojee,1 cup organic lemonade,2 table spoon, chopped fresh mint or basil leaves.",
"Smooth Coconut,1 serving of Greenberry Shakeolojee, 2 table spoon. mashed avocado,one fourth tea spoon coconut extract (optional),half cup coconut milk beverage and half cup water.",
"<p>Rum Spice,<p/> 1 serving of Chocolate Vegan Shakeolojee, one eight tea spoon rum extract,1 cup coconut milk beverage,one fourth tea spoon ground nutmeg and lastly one fourth tea spoon of ground cinnamon.",
"<p>Choco Orange, </p> 1 serving of Chocolate Vegan Shakeolojee, 1 cup 100% orange juice."
];
var cardTitle = "Beachbody Shakeology Recipe";
var repromptText = "Wanna try something different? Say, Beach body give me next recipe";
var prefixContent = "Based on the most popular shakes for your recent workout, I think you would enjoy the chocolate Spiced Orange Blossom shake ";
prefixContent += "<break time = \"0.5s\"/>";
prefixContent += "To find out the recipe," + "<break time = \"0.5s\"/>"+" Ask beach body, give me the recipe for Spiced Orange Blossom shake.";
ndex=7;
var cardContent = recipes[index];
if (!intent.slots.shake.value) {
var prefixContent = "Based on the most popular shakes for your recent workout, I think you would enjoy the chocolate Spiced Orange Blossom shake.";
prefixContent += "<break time = \"0.5s\"/>";
prefixContent += "To find out the recipe, Ask beach body, give me the recipe for Spiced Orange Blossom shake.";
} else {
var prefixContent = "The recipe is. " + cardContent;
}
var speechOutput = {
speech: "<speak>" + prefixContent + "<break time = \"0.5s\"/>" + "</speak>",
type: AlexaSkill.speechOutputType.SSML
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.askWithCard(speechOutput, repromptOutput, cardTitle, cardContent);
}
/**
* Invoke onboarding Microservice
*/
function getOnboardingResults(eventCallback) {
var options = {
"method": "GET",
"hostname": "onboarding-origin.api.beachbodyondemand.com",
"port": null,
"path": "/v1/user/recommendations/EDC850BD-7367-47B4-B5F4-2C328998C256/by-entitlement?version=thunderbird&limit=4&email=dsandoval@beachbody.com",
"authorization": "BBOD123",
"content-type": "application/json",
"accept": "application/json"
};
var req = http.request(options, function (res) {
var body = '';
res.on("data", function (chunk) {
body += chunk;
});
res.on("end", function () {
//console.log(body.toString());
body = body.replace("\n", "\\n");
body = JSON.parse(body);
eventCallback(body);
});
}).on('error', function (e) {
console.log("Got error: ", e);
});
req.end();
}
/**
* Invoke Content API Microservice
*/
function getContentAPIData(entity, eventCallback) {
var options = {
"method": "GET",
"hostname": urlPrefix,
"port": null,
"path": "/"+entity,
"headers": {
"content-type": "application/json",
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var body = '';
res.on("data", function (chunk) {
body += chunk;
});
res.on("end", function () {
body = body.replace("\n","\\n");
var stringResult = JSON.parse(body).items[0].description.raw;
eventCallback(stringResult);
});
}).on('error', function (e) {
console.log("Got error: ", e);
});
req.end();
}
/**
* Invoke content Microservice
*/
function getProgramData(brandCode, eventCallback) {
var options = {
"method": "GET",
"hostname": "api-club.teambeachbody.com",
"port": null,
"path": "/v2/programs/"+brandCode,
"headers": {
"authorization": "<redacted>",
"content-type": "application/json",
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var body = '';
res.on("data", function (chunk) {
body += chunk;
});
res.on("end", function () {
//console.log(body.toString());
body = body.replace("\n","\\n");
body = JSON.parse(body).programs[0];
eventCallback(body);
});
}).on('error', function (e) {
console.log("Got error: ", e);
});
req.end();
}
// Create the handler that responds to the Alexa Request.
exports.handler = function (event, context) {
// console.log("begin5");
// Create an instance of the HistoryBuff Skill.
var skill = new BBskill();
skill.execute(event, context);
};/**
* Created by jaina on 11/29/16.
*/
{
"intents": [
{
"intent": "GetFirstEventIntent"
},
{
"intent": "GetNextEventIntent"
},
{
"intent": "GetDetailEventIntent",
"slots": [
{
"name": "contestant",
"type": "CONTESTANT"
}
]
},
{
"intent": "GetWorkoutSummaryIntent"
},
{
"intent": "GetProgramDetailIntent",
"slots": [
{
"name": "program",
"type": "PROGRAM"
}
]
},
{
"intent": "OnboardingIntent",
"slots": [
{
"name": "programType",
"type": "PROGRAMTYPE"
},
{
"name": "programDuration",
"type": "PROGRAMDURATION"
},
{
"name": "fitness",
"type": "FITNESSLEVEL"
}
]
},
{
"intent": "GoalIntent"
},
{
"intent": "VideoIntent"
},
{
"intent": "NutritionIntent",
"slots": [
{
"name": "shake",
"type": "SHAKE"
}
]
},
{
"intent": "AMAZON.HelpIntent"
},
{
"intent": "AMAZON.StopIntent"
},
{
"intent": "AMAZON.CancelIntent"
}
]
}
GetFirstEventIntent what is twenties
GetFirstEventIntent tell me about twenties
GetFirstEventIntent tell me more about twenties
GetFirstEventIntent about twenties
GetDetailEventIntent tell me about twenties contestant {contestant}
GetDetailEventIntent tell me about beachbody contestant {contestant}
GetDetailEventIntent tell me about beachbody trainer {contestant}
GetDetailEventIntent tell me about {contestant}
GetDetailEventIntent who is {contestant}
GetWorkoutSummaryIntent what was my last workout
GetWorkoutSummaryIntent about my summary of workouts
GetWorkoutSummaryIntent how much did I workout
GetWorkoutSummaryIntent how did I do
GetWorkoutSummaryIntent how am I doing
GetWorkoutSummaryIntent about my workout summary
GetProgramDetailIntent tell me about workout program {program}
GetProgramDetailIntent tell me more about workout program {program}
GetProgramDetailIntent about program {program}
GetProgramDetailIntent about workout program {program}
OnboardingIntent {programType}
OnboardingIntent {programDuration}
OnboardingIntent {fitness}
OnboardingIntent to recommend me a workout program
OnboardingIntent to recommend
GoalIntent to set my daily calorie goal
VideoIntent to start my next workout
NutritionIntent about shakeology shakes
NutritionIntent give me the recipe for
NutritionIntent give me the recipe for {shake}
AMAZON.StopIntent no
AMAZON.StopIntent nope
AMAZON.StopIntent no thanks
AMAZON.StopIntent no thank you
Comments