Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alexa-ability

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alexa-ability

An Alexa skills framework for node

  • 0.12.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

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

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);

Keywords

FAQs

Package last updated on 01 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc