X
    Categories Company NewsPerformance Monitoring

GitHub Webhooks + Spark Core + Heroku = GitGong

GitHub Webhooks allow you to build or set up integrations which subscribe to certain events on GitHub.com.

Spark.io: A $19 postage stamp-sized hackable Wi-Fi module for interacting with physical things.

Heroku is a cloud application platform – a newfangled way of building and deploying web apps.

Put them together with some scrap wood, servo, vintage clock chime, paperclip, misc hardware, and you’ve got yourself a team-building, code-collaborating, conversation piece. This project was inspired by the presence of a Spark Core in our office and the fact that GitHub has webhooks. Heroku proved to be the perfect glue to bring everything together.

Instructions:

  1. Get a Spark Core or Photon. Register, claim-your-device, & flash HelloWorld via wifi.
  2. Connect your servo and calibrate – Play with angles to determine min/max – write down your angle setting when you encounter “servo-growling” so you can avoid that high-voltage state. Choose a generous angle range > 90° that has plenty of buffer between min and max. (eg: 30° – 160°) Here’s our spark code: https://github.com/caseprince/git-gong/blob/master/spark-gong.ino
  3. Mount servo on rube-goldberg contraption w/ bell & clapper, keeping your angle range in mind.
  4. Sign up for a free Heroku account and deploy something like this: https://github.com/caseprince/git-gong/blob/master/github-listener.rb You’ll need to swap in your Spark API key in env.rb, and update __YourCoreName__ to talk to your core.
  5. Test by hitting your Heroku URL. (eg: “sweet-gong-12345.herokuapp.com”)
  6. Create a “Push event only” webhook on a GitHub repo pointing to your new Heroku app. (You’ll need admin privileges on the repo.) Test by pushing to your repo.
  7. “Gong”
  8. ???
  9. Profit.

Here’s a video of this contraption in action:

Future Enhancements:

We’ve got lots of free analog and digital pins available on our Spark Core, so can always add  more physical devices, & more webhook specificity, to our corner of The Internet of Things. Some ideas include adding a Relay Shield and turning on a fan to drive some wind chimes when we merge into master, or triggering an air-raid siren when our Jenkins build breaks. And GitHub’s not the only service to provide webhooks – maybe next we’ll hook into Jira and use a robot arm to draw burndown charts with a wood-burning tool! The possibilities are endless!

 

Case Prince: Case is a Senior Web Developer at Appneta by day and a Traffic-Cone-Space-Gladiator by night. He enjoys pixels, LEDs, Legos, sushi, Funk, Hip hop, cats, and the color orange.