0.12.0 • Published 9 years ago

alexa-ability v0.12.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

alexa-ability Build Status

An Alexa Skills Kit framework for node.

Features

  • Asynchronous middleware and intent handlers
  • Robust error handling
  • Easy access to session and slots data
  • Well tested
  • Integrates well with any framework

Related packages

Example (es5 version)

import { Ability, events } from 'alexa-ability';
import { handleAbility } from 'alexa-ability-lambda-handler';

// create our skill
const app = new Ability({
    applicationId: 'my-application-id'
});


// add middleware function that run before every request
app.use(function(req, next) {
    console.log('Handling:', req);
    next();
});


// handle LaunchRequest - "Alexa, launch MyApp"
app.on(events.launch, function(req, next) {
    const cardTitle = 'Greetings';
    const cardContent = 'Hello world!';
    const speech = (`
        <speak>
            Hello <break time="100ms" /> world
        </speak>
    `);

    req.show(cardTitle, cardContent).say('ssml', speech).send();
});


// handle SessionEndedRequest - "Alexa stop"
app.on(events.end, function(req, next) {
    console.log(`Session ended because: ${req.reason}`);
    req.say('Goodbye!').end();
});


// handle custom intents
app.on('MeaningOfLifeIntent', function(req, next) {
    asyncRequest(function(err) {
        if (err) return next(err);
        req.say('42').end();
    });
});


// catches any unhandled requests
app.use(function(req, next) {
    req.say('I don\'t know what to say').end();
});


// gracefully handles any uncaught errors
app.use(function(err, req, next) {
    req.say('Uhoh, something went wrong').end();
});


// export as a lambda handler
export const handler = handleAbility(app);
0.12.0

9 years ago

0.11.1

9 years ago

0.11.0

9 years ago

0.10.1

9 years ago

0.10.0

9 years ago

0.9.1

9 years ago

0.9.0

10 years ago

0.8.1

10 years ago

0.8.0

10 years ago

0.7.2

10 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.6

10 years ago

0.3.5

10 years ago

0.3.4

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago