Things used in this project

Hardware components:
Echo
Amazon Alexa Amazon Echo
×1
Software apps and online services:
Dp image kit 02
Amazon Alexa Alexa Skills Kit
Screen%20shot%202015 07 20%20at%206.10.26%20pm
Amazon Web Services AWS Lambda

Schematics

Diagram
How the skill works
Alexa diagram d5zfptlsid

Code

AWS Lambda codeJavaScript
Server end code to generate Alexa response
'use strict';
var Alexa = require('alexa-sdk');

var APP_ID = "ID here";
var SKILL_NAME = "ironrich";

/**
 * Array containing iron rich foods.
 */
var lines = [
"Clams, canned, drained Kellogg's",
"Special K cereal Grape Nuts",
"Cheerios",
"Cream of Wheat (instant)",
"Raw oysters",
"Hamburger",
"Carnation Instant Breakfast",
"Pizza w/meat, vegetables, thick crust Lentils",
"Spinach",
"Potato, baked",
"Beef steak, lean",
"Kidney beans",
"Shrimp",
"Spaghetti w/tomato sauce Oatbran muffin",
"Turkey, dark meat, cooked Hummus",
"Macaroni",
"Pumpkin, canned",
"Eggs, scrambled Mushrooms, cooked",
"Tofu, raw, firm",
"French toast",
"Whole wheat bread",
"Green peas",
"Figs, dried"
];

exports.handler = function(event, context, callback) {
    var alexa = Alexa.handler(event, context);
    alexa.APP_ID = APP_ID;
    alexa.registerHandlers(handlers);
    alexa.execute();
};

var handlers = {
    'LaunchRequest': function () {
        this.emit('GetFact');
    },
    'GetNewFactIntent': function () {
        this.emit('GetFact');
    },
    'GetFact': function () {
        // Get a random  food from the   list
        var factIndex = Math.floor(Math.random() * lines.length);
        var randomline = lines[factIndex];

        // Create speech output
        var speechOutput = randomline;

        this.emit(':tellWithCard', speechOutput, SKILL_NAME, randomline)
    },
    'AMAZON.HelpIntent': function () {
        var speechOutput = "Say something like give me a food rich in iron";
        var reprompt = "Give me a food rich in iron";
        this.emit(':ask', speechOutput, reprompt);
    },
    'AMAZON.CancelIntent': function () {
        this.emit(':tell', 'Goodbye!');
    },
    'AMAZON.StopIntent': function () {
        this.emit(':tell', 'Goodbye!');
    }
};

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

WiFi Strength Meter
Easy
  • 499
  • 6

A meter that indicates the Wi-Fi signal strength in an intuitive way, using the parts I had on hand.

Cryptocurrency Price Checker!
Easy
  • 171
  • 2

Full instructions

With the recent rise in cryptocurrencies, this Price Checker will keep you up to date with the most recent market fluctuations!

Trademark Master
Easy
  • 326
  • 10

Work in progress

Trademark Master tells you if any string has already been registered.

Opening Bell
Easy
  • 1,555
  • 23

Full instructions

A simple Alexa voice skill to retrieve the current performance of a publicly traded stock (NASDAQ, NYSE) using the company name.

Brick Bot
Easy
  • 706
  • 14

Protip

A one-stop-skill for your LEGO® needs! Alexa can tell you available sets, themes, and sub-themes and give you details based on set numbers.

Funny Quoter
Easy
  • 328
  • 8

Full instructions

This has some of the weirdest quotes up her sleeve! If you're feeling blue, and need something to cheer you up, just call on Funny Quoter.

Add projectSign up / Login