Brent Saltzman


Interested in all things technology with a passion for analog, design, audio, and anything that sparks creativity and imagination.


Pushover Notifications

There are only a handful of apps that I can't live without, let alone I would blog about for free (but if Superblock wants to throw some stickers my way, I'll put them in good places :)). One of them is Pushover. Pushover is a simple notifications app that allows you to program your scripts and applications to make use of Apple's APNS (or Apple Push Notification Service. Oh and there's an Android app too) It's not free, it'll set you back $4.99, but if you need it, it's worth it. This is an app that requires you to do some work before it's actually useful to you. They have an extensive API where you can program their service in just about every language you could write in and they have an email gateway so you can send emails to trigger notifications. I've used Pushover's API in PHP, Node.js, Ruby, Batch scripts, and they even integrate with IFTTT (a topic for a future post).

Here are just a few uses on where I'm leveraging Pushover's amazing service:

  • Adium, my preferred chat client on OS X will send me a Pushover notification when I get a chat message and my screen saver is turned on. The message will be sent to my phone where I can respond to the person either by using IM, IRC, or Email.
  • I redirect my SQL backup email notification to Pushover's email gateway, giving me the notification that my production database has been backed up while keeping my inbox clean.
  • ThinkUp now includes support for Pushover. I get insights sent directly to my iPhone and iPad when they happen.
  • I use the ZNC Pushover module to send any mentions I get on IRC while i'm not connected to my phone.
  • IFTTT will send me the weather when it gets sketchy out, when it starts to snow, tracking updates on packages, and when new RSS feed items are posted.
  • I've integrated Pushover with a few projects at work to send me information on the go.
  • When my home has lost power and when it gets turned back on. This is one of my favorites, let me explain how this one works:

Pushover1

So I have a Windows Server 2008 box that's attached to a Uninterruptible Power Supply, which is a technical term for big battery so it can keep running and automatically shut down the server when the power goes out. There's an application running on the server that monitors the UPS and facilitates a safe shutdown in 5 minutes when the UPS looses utility power. Luckily it writes these events to the Windows system log (or Event Viewer). With this i'm able to run scheduled tasks based off specific Events. So, using cURL and Pushover's HTTP API I wrote a batch file that sends the Pushover Notification and I have it scheduled to run whenever the "Lost Power" event is logged. The screenshot on the right is what it looks like on my phone when my home looses power. The notification gets send approximately 15 seconds after the loss. Thanks to Pushover's feature set I'm even able to send along the link to the local utility company's website to report it. Here's what the batch file looks like:

curl -s \  

    -F "token=myAppTokenHere" \  
    -F "user=myUsuerIdHere" \  
    -F "message=UPS has lost power, I am shutting down in 5 minutes."  \  
    -F "url=https://ww3.oppd.com/ior/default.aspx"  \  
    -F "url_title=Report it to OPPD"  \ 
        -F "priority=2" \  
        -F "retry=30"  \ 
        -F "expire=120"   
    https://api.pushover.net/1/messages.json

The alert will keep popping up every 30 seconds until I acknowledge it, or after 120 seconds. I also use the same method to let me know when the power is restored. (You guessed it, that's also logged in the Windows syslog!)

pushover2So that's how I use Pushover. A wonderful service that gives you some great flexible notification options for your projects. If you've got some coding chops you can easily and painlessly integrate their service into your projects too!

 

Previous Post | Next Post