npm install serverless-alexa-ability --save
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();
});
};
app.say('hello world').end();
app.ssml('<speak><say-as interpret-as="spell-out">hello</say-as></speak>').end();
If you have some logged in functionality, but they have yet to login
app.say('Please login').linkAccount().end();
app.say(
'Hello!'
).card({
type: 'Simple',
title: 'Hello',
content: 'World'
}).end();
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();
});
};
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();
app.session({
foo: 'bar',
hello: 'world'
});
const event = app.event();