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

reverb

v0.2.0

Published

Push-based client library for Amazon Echo

Downloads

89

Readme

Reverb

Is there an Echo in here?

What?

Reverb is an open source library for creating custom interactions with the Amazon Echo. Unlike existing solutions, Reverb uses a true "push"-style interaction and does not rely on using a simulated or real web browser behind the scenes. This makes it fast and lightweight on both your network and your machine.

Usage

NPM

For now, Reverb requires you to get extract some data by hand. These are the "Cookie" header and the device serial number. These can both be easily acquired using the Developer Tools that come with Chrome. Simply open the Echo web app and open the Network tab of the developer tools. Click on the Filter icon (it looks a bit like a funnel) and filter down to "WebSockets." Then, refresh the page.

There should be a single entry in the list pointing to dp-gw-na-js.amazon.com. Select that and go to the "Headers" tab. The serial number you want will be the x-amz-device-serial parameter under "Query String Parameters," and the "Cookie" is the (potentially huge) string next to Cookie: under "Request Headers."

Now that you have those, it's simple to get access to the Echo's transcriptions of your requests:

var Reverb = require('reverb');
new Reverb({
    cookie: // The Cookie retrieved above
  , serial: // The serial retrieved above
}).on('ready', function() {
    // this is emitted when the connection is
    //  established and the hands have been shaked
    console.log("Ready!");
}).on('activity', function(activity) {
    // parse the transcription and do something
    //  with it here
    console.log("You said:", activity.summary);
}).on('timerStart', function(timer) {
    // do something when timers are started
    console.log("timer started:", timer.remainingTime);
}).on('timerPause', function(timer) {
    // do somethign when timers are paused
    console.log("timer paused:", timer.remainingTime);
}).on('timerComplete', function(timer) {
    // do something when timers complete
    console.log("timer complete");
}).on('alarmSet', function(alarm) {
    // do something when alarms are set
    console.log("alarm set:", alarm);
}).on('alarmUpdate', function(alarm) {
    // do something when alarms are changed
    console.log("alarm time updated:", alarm.alarmTime);
}).on('alarmComplete', function(alarm) {
    // do something when alarms complete
    console.log("alarm complete");
}).on('alarmRemove', function(alarm) {
    // do something when alarmas are turned off
    console.log("alarm unset");
});

Note that, as with other solutions, you will have to append "cancel" or "stop" to the end of your custom commands to prevent Echo from trying to process it.

Future Work

  • Provide an easy mechanism for authenticating
  • Perhaps, provide an "Action Dispatcher" to make parsing the activity text easier
  • Perhaps, provide a useful -g install
    • Plugins could be dropped into a folder

Why?

The Amazon Echo's voice capabilities are truly amazing, but they have yet to provide a proper API for extending its capabilities. I was not satisfied with the "poll"-style mechanism used in existing solutions and wanted to see if there was something better.