Skip to content
Alexa homeskill v3
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.coveralls.yml
.editorconfig
.gitignore
.travis.yml
README.md
code.js
index.js
package.json
utils.js

README.md

Alehos, Alexa homeskill built quickly

Build Status JavaScript Style Guide

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

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 payload of the intented error. Example:

// if the device is un reachable
let err = new Error()
err.payload = {
  type: alehos.code.ERR_ENDPOINT_UNREACHABLE,
  message: 'device is unreachable'
}
return cb(err)

todos

  • support all functions
  • set/get the event function

license

MIT

You can’t perform that action at this time.