serverless-alexa-ability

0.1.9 • Public • Published

serverless-alexa-ability Build Status

Installation

npm install serverless-alexa-ability --save

Quick Example

handler.js

import { Ability } from 'serverless-alexa-ability';
 
exports.index = (event, context, callback) => {
 
  const app = new Ability(event, callback);
  
  app.on('askWeather', () => {
    app.say('The weather is 18 degrees and sunny').end();
  });
 
};

Documentation

Say

app.say('hello world').end();

SSML

app.ssml('<speak><say-as interpret-as="spell-out">hello</say-as></speak>').end();

Link account

If you have some logged in functionality, but they have yet to login

app.say('Please login').linkAccount().end();

Card

app.say(
  'Hello!'
).card({
  type: 'Simple',
  title: 'Hello',
  content: 'World'
}).end();

Conversation

import { Ability } from 'serverless-alexa-ability';
 
exports.index = (event, context, callback) => {
 
  const app = new Ability(event, callback);
  
  // User says "Do you like cats?"
  app.on('likeCats', () => {
    app.say('I like cats, do you like cats?').converse();
  });
  // User says "Yes"
  app.on('likeCats/AMAZON.YesIntent', () => {
    app.say('Phew thats good, now we can be friends').end();
  });
  // User says "No"
  app.on('likeCats/AMAZON.NoIntent', () => {
    app.say('Well this is awkward'.end();
  });
 
};

Reprompt

app.say(
  'The weather is 18 degrees and sunny, is there anything else I can help with?'
).repromptSay(
  'Is there anything else I can help with?'
).converse();
 
app.say(
  'The weather is 18 degrees and sunny, is there anything else I can help with?'
).repromptSsml(
  '<speak>Is there anything else I can help with?</speak>'
).converse();

Create Sessions

app.session({
  foo: 'bar',
  hello: 'world'
});

Get Event

const event = app.event();

Package Sidebar

Install

npm i serverless-alexa-ability

Weekly Downloads

8

Version

0.1.9

License

ISC

Last publish

Collaborators

  • jholt1