alexa-ability
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
import { Ability, events } from 'alexa-ability';
import { handleAbility } from 'alexa-ability-lambda-handler';
const app = new Ability({
applicationId: 'my-application-id'
});
app.use(function(req, next) {
logRequest(req);
next();
});
ability.on(events.launch, function(req, next) {
const cardTitle = 'Greetings';
const cardContent = 'Hello world!';
const speech = (`
<speak>
Hello <pause time={100} /> world
</speak>
`);
req.show(cardTitle, cardContent).say('ssml', speech).send();
});
ability.on(events.end, function(req, next) {
console.log(`Session ended because: ${req.reason}`);
req.say('Goodbye!').end();
});
ability.onError(function(err, req, next) {
req.say('Uhoh, something went wrong').end();
});
ability.on('MeaningOfLifeIntent', function(req, next) {
asyncRequest(function(err) {
if (err) return next(err);
req.say('42').end();
});
});
export const handler = handleAbility(ability);