one client library for "alexa" "api-ai" "google-actions"
MIT License
one client library to rule them all (api-ai, google-action, alexa, ...)
$ yarn add voice-assistant-js
then you should install the client library you want.
actions-on-google
and express
if you want to use api-ai or google-actions
alexa-sdk
if you want to use alexa
make sure you use at least
node-6.10
require('reflect-metadata')
const lambda = require('voice-assistant-js').lambda
class IntentClass {
/**
* @param {IEvent} event
*/
say (event) {
event.tell('say')
}
/**
* @param {IEvent} event
*/
ask (event) {
event.ask('ask')
}
}
const mapping = {
say: IntentClass,
ask: IntentClass
}
exports.handler = lambda(mapping)
so if you the lamda is invoked with the intent ask
the function IntentClass.ask
is called...
//TODO
$ yarn test