PUSH and the Feed-Based AutoResponder

Several times over the last few years, I’ve posted about “daily RSS feeds” or feeds that point to static content that can be scheduled so that the content is delivered to you in a drip feed fashion over an extended period of time via the feed. One problem with this is what to do if you want the next item delivered ahead of schedule? For example, you read one item, and immediately want the next, but it’s not slated for delivery for another 22 hours?

Ideally, what we want is something like an auto-responder. (You’re probably familiar with auto-responders in the context of email or SMS: send a message to a particular address or number, and immediately get a response back.)

So here’s something I’ve started mulling over, now things like the Google Feed API support PubSubHubbub/PUSH (the ability to literally push content to another service once it is published).

Suppose I subscribe to an RSS feed in Google Reader. The feed has a URL that is unique to me. The feed points to “static” content, such as a report. When I subscribe to the feed, it contains just the first item. Now suppose I read the post, and click a link that corresponds to a “feed management” URL which results in another item being added to the feed, and a ping being sent to a PubSubHubbub listener hub. My feed reader, which is also signed up to the hub, is informed that new content is available and it appears in my feed reader, almost immediately. That is, we have an autoresponding feed :-)

PS This is related… Back last year when I was in Cambridge as part of the Arcadia Fellowship programme, I took the opportunity to grab a coffee with Jim Downing and Peter Murrary Rust. I remember Peter asked what was particulalry interesting me at the time, and it was the notion of webhooks. I don’t think I’ve blogged explicitly about these before, but the idea behind a webhook is simple: it’s an HTTP callback…

(I’m just imagining blank faces…)

Here’s something you might know… there’s a way of getting content into a web page once it’s loaded using the HTML <script> tag. This tag can be used to load Javascript content into a web page dynamically using a javascript object (the object contains the content you want). In order to get hold of the content, you need to wrap it in a Javascript function; then, when the Javascript has loaded, the function is called and does something to the content, like display it in your web page. If you ever hear about JSON, this is what people are talking about: a web page makes a request to a URL for some content or data packaged as a Javascript object, and the webserver on the end of the URL passes that content back. So that the web page can grab hold of the javascript object, it often passes a function name to the webservice. When the webservice passes the object back, it does so as the single argument in the user specified function. This is called a callback. Web page asks URL for data and sets package it in this callback function; webservice gets the data, wraps up in the callback function container, and sends it back to the webpage, which executes the callback function.

So what are webhooks? Webhooks are callbacks too, but rather than wrapping the data in a javascript function call, the callback is made to another webservice, via a URL and HTTP POST, using the requested data. Got that? In a JSON scenario, I ask a web service for data and give it a callback function name; it gets the data, wraps it up in with the function name I provided, and passes it all back to me, at which point I execute the function using the data it was passed back with. In the webhooks scenario, I make a request for data and ask that a service I have identified by a URL is given the data, so that it can do something with it.

And that’s webhooks.

So how do webhooks relate to things like PUSH? Well, if a service offers a PUSH service, don’t you think it would be handy to be able to sign up to that service with a URL of another service that will do something with the data being PUSHed? That’s a webhook…

PPS something I keep meaning to play with: webhooks for WordPress – HookPress.

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...