numbers for people.

Using Pebble.js to hit PagerDuty

Pebble released a JavaScript-only API.

To try it out, I threw together a quick script that polls the PagerDuty API for the number of incidents assigned to a user and then vibrates & updates the screen when it changes.

  • I installed the SDK & forked this project.
  • Make the basic changes to appinfo.json
  • All of the interesting code went in app.js
  • Running pebble build rolls app.js and the PebbleJS library up into a 7-8000 line pebble-js-app.js
  • pebble install --phone sends it over.

All told, it was pretty easy,

PebbleJS makes it really easy to throw up a basic UI:

Ordinarily I’d use PDJS, but PebbleJS exposes an ajax object that’s slightly different than jQuery’s 1. Either way the code to hit our API is pretty easy:

Still haven’t figured out configuration side of things, so I’ve just hard coded a read-only UI key for my webdemo account:

Giving the user feedback is pretty easy:

If this is the kind of thing that you want to be involved in, come work at PagerDuty.

  1. As always, I found Runscope invaluable in figuring out what was going on.

Comments are closed.