Skip to content

Trudeaucj/alexa-annotations

 
 

Repository files navigation

alexa-annotations

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-annotations';
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-annotations/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})`});
    });
  }

}

About

Create Alexa Skills using ES6 classes, promises, and ES7 decorators

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%