npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wavelength

v1.0.2

Published

Framework for building Alexa skills with Amazon Echo using AWS Lambda

Downloads

8

Readme

Wavelength is a framework that simplifies working with the Alexa SDK when using Amazon Lambda services on the back-end.

The Alexa Skills Kit is the programming interface to create skills for Amazon Echo devices and other Alexa enabled services.

Amazon Lambda is a computing mechanism where you can write a "cloud function" that can be hosted and executed on demand. Instead of running a server 24/7, AWS takes care of making your function available (and scaling to handle request capacity). AWS has a rather generous free-tier so you should be able to host quite a few lambda functions before incurring any charges.

For information on how to develop skills using the Alexa Skills Kit, go to: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit

And for information about using AWS Lambda, see: http://docs.aws.amazon.com/lambda/latest/dg/welcome.html

Amazon makes it very straight-forward to trigger your lambda function from the Alexa Skill.

The project name of wavelength is because lambda is the symbol for wavelength in physics equations and an echo is the reflection of a sound wave.

Example

var wavelength = require("wavelength");

var router = wavelength.Router();
module.exports = router;

router.launch(function(event) {
	return wavelength.Response()
		.text("Tough decision to make? I'll help you pick. For example, you can ask: 'Should I choose chocolate, or vanilla?'")
		.reprompt.text("Go ahead, ask me something like: red, or blue");
});

router.intent("ChooseIntent", function(params, event) {
	console.log("Params - " + JSON.stringify(params));
	if(!params.first || !params.second) {
		return wavelength.Response()
			.text("I didn't understand your choices, please say something like: 'should I choose the red shoes or the black ones'")
			.reprompt.text("Go ahead, don't be shy.");
	}
	var chosen = (Math.random()<0.5) ? params.first : params.second;
	console.log("Choice was " + chosen);
	return wavelength.Response()
		.text("Between " + params.first + " and " + params.second + " I would choose " + chosen)
		.end_session(event.session.new)
		.reprompt.text("Can I help you with any other decisions?");
});

router.intent("Goodbye", function(params, event) {
	return wavelength.Response()
		.text("Good luck. Let me know how it goes!")
		.end_session(true);
});

Router/Response Features

  1. Router class to handle intent/launch mapping
  2. session_started and session_ended events
  3. Optional application-id validation on requests
  4. Synchronous or Asynchronous handler definitions
  5. Simplified access to slot parameters and full access to the event data
  6. Session attribute management
  7. Build responses with text/ssml, including reprompts, cards, and options.
// Usage:
var wl = require("wavelength");
var router = wl.Router();

router.launch(function(event) { // Synchronous launch
   return wl.Response(event).text("response");
});

router.launch(function(event, callback) { // Asynchronous launch
    callback(wl.Response(event).text("response"));
});

router.intent("intent_name", function(params, event) { // Synchronous intent
    return wl.Response(event).text("response");
});

router.intent("intent_name", function(params, event, callback) { // Asynchronous intent
   callback(wl.Response(event).text("response"))
});

router.session_started = function(event, context, callback) { // session_started hook
  callback();
};

router.session_ended = function(event, context, callback) { // session_ended hook
  callback();
};

// Set router.applicationId to your application's ID if you want to verify the applicationId on each request.