davor babic

Using Pushover with Common Lisp

Pushover is a small app that let’s you push notifications to your phone in a very simple and elegant way. It’s available on both Android and iOS.

It’s great for all those small things that you’d otherwise feel too lazy to write a proper app for. I’ve used to for receiving notifications of when a build breaks, when people push commit to a certain repository and a bunch of other stuff.
















(defparameter *pushover-url*
  "http://api.pushover.net/1/messages.json")

(defun pushover (message user token)
  "Returns 200 if everything went well,
   4xx if your input was invalid and
   500 if pushover.net is having problems"

  (let ((content-type
         "application/x-www-form-urlencoded")
        (content (concatenate 'string
                              "message=" message
                              "&user="   user
                              "&token="  token)))
    (car (trivial-http:http-post
          *pushover-url* content-type content))))

As you can see from this example that I hacked together in CL, they’ve got a great API that’s super easy to use.