alexa-lambda-skill

4.0.1 • Public • Published

alexa-lambda-skill

Build Status NPM Version License

Easily create Alexa Skills to run on AWS Lambda using ES6 classes and ES7 decorators.

Try it in the online playground or create your own Alexa skill with the Yeoman generator.

Example

import { Skill, Intent, Launch } from 'alexa-lambda-skill';
import { ask, say, card } from 'alexa-response';
import fetch from 'isomorphic-fetch';
 
@Skill
export default class Echo {
 
  @Launch
  launch() {
    return ask('Welcome to the example Echo skill! What would you like me to repeat?');
  }
 
  @Intent('echo')
  echo({ sentence }) {
    return say(sentence).card({ title: 'Echo', content: sentence });
  }
 
  @Intent('AMAZON.HelpIntent')
  help() {
    return ask('I repeat whatever you say to me! What would you like me to repeat?');
  }
 
  @Intent('AMAZON.CancelIntent', 'AMAZON.StopIntent')
  stop() {
    return say('Goodbye');
  }
 
  @Intent('Credits')
  credits() {
    const url = 'https://raw.githubusercontent.com/cameronhunter/alexa-lambda-skill/master/package.json';
    return fetch(url).then(response => response.json()).then(({ name, author }) => {
      return say(`${name} was created by ${author.name}`).card({ title: name, content: `Credits: ${author.name} <${author.email}> (${author.url})`});
    });
  }
 
}

Package Sidebar

Install

npm i alexa-lambda-skill

Weekly Downloads

5

Version

4.0.1

License

MIT

Last publish

Collaborators

  • cameronhunter