Simple Notification Proof Of Concept With Instapush
Instapush is a pretty nifty services that acts as a push notifications inbox. I used to be the kind of person who kept push notifications off on all my applications but as time went on I wanted timely information in the form of emails and push notifications more often. For example, I wanted breaking news on the stock market so I can act on that. I also want real time updates on my Internet Of Things home set up. Instapush provided a free and easy way to test my services ideas and I could move them to a dedicated server when needed.
Setting up Instapush is pretty easy. Just get an account on their site, download the mobile app and you’re done. IFTTT offers a number of recipes for Instapush but this blog will focus on writing your own simple integration.
Step one here will be just making sure it works. Instapush provides a simple REST api and you can read about it here. For this project I used a node module that’s a client library for Instapush. It hasn’t been worked on in a while but all the basic functionality is there. If you were to build something lasting I would recommend just interfacing with the REST api directly.
For this proof of concept we’re going to use another module called chokidar which is a file system wrapper for Node.js. We’ll create a simple event emitter that will watch for changes to the file system and on change send what was changed and the file name to my phone in the form of a notification.
Pro Tip
When using chokidar be sure so enable ignoreInitial. If not you’ll read your whole file system in.