alehos3
v2.1.2
Published
Make Alexa homeskill quick, with v3
Downloads
30
Readme
Alehos, Alexa homeskill built quickly
Note: this package is under development, you should no rely on this for production.
So that you dont need to write boilerplate code for Alexa Home Skill with Nodejs.
Alehos support routing for the Smart Home Skill API v3.
how to use
let Alehos = require('alehos3')
let alehos = new Alehos()
alehos.registerHandler('discover', (req, cb) => {
// get the payload
// const payload = { ... }
cb(null, null, payload)
})
alehos.registerHandler('powerControllerTurnOn', (req, cb) => {
// action ...
// finally return OK
cb(null)
})
exports.handler = function(event, context, cb) {
alehos.handle(event, context, cb)
}
supported functions
discover
: discoverypowerControllerTurnOn
: turn onpowerControllerTurnOff
: turn offauthorization
: Alexa.Authorization Interface
If you don't provide equivalent function, the response will be INVALID_DIRECTIVE
.
req
req
is actually the event
and context
object from lambda request. You should looking at event for request message.
cb(err, contextProperties, eventPayload)
cb
is the response function.
If you want to return error, generate an new error object, with code of the intented error. Example:
// if the device is un reachable
let err = new Error()
err.code = alehos.code.ERR_ENDPOINT_UNREACHABLE
return cb(err)
todos
- [ ] support all functions
- [ ] set/get the event function
license
MIT