A recent post by Progrium (aka webhook’s biggest evangelist) reminded me that I needed to show how easy it was to plug Superfeedr in a network of webhooks. Here is what you can do, quite quickly!
Piping
One of the great things with webhooks is that they’re litterally just HTTP urls that can run some arbitrary code. Once you understand that a given hook can also call another hook, it’s obvious to think that you can chain multiple hooks to reach the result you want.
For example, you could have a webhook that converts some data into some other data before calling another hook.
Example
Let’s say I have a Tumblr account that agregates several feeds that I really like1. I want to use Superfeedr to do that. Let me show you how it’s done.
Tumblr API.
Tumblr is currently unable to ingest JSON or Atom. However they offer a posting API. Since Superfeedr does not support this API, nor does auth, we will have to send the Superfeedr notifications to a webhook which will extract the meaningful data and post it to Tumblr.
Webscript
For this, let’s use webscript.io. Once you’ve created a new webscript account, just create a new webhook and use the following code in it (make sure you fill the missing data too!):
Now, reserve the url of your webscript. We will have to plug that url into Superfeedr.
Superfeedr
Open the Superfeedr PubSubHubbub Console. In the topic field, put the url of a feed that you want to repost, and in the callback field
put the url of your webscript. Do not forget to check for JSON conversion.
Once you do that, as soon as Superfeedr detects an update in the feed, it will post that to webscript, which in return will post to Tumblr. That’s it, you’ve piped some RSS content from Superfeedr to Tumblr, thru Webscripts. You can of course rinse and repeat with more feeds.
Conclusion
Of course, this is just a small demo. The Lua scripting used by Webscript can actually be used to do a lot more, like send emails, convert the data, save it… etc. If you like IFTTT but always felt like you wanted to build a couple of rules that were a little more custom, then, webhooks are an amazing way of doing it :)
I want to thank Steve Marx for his precious OAuth help.
1 This is a feature that Tumblr used to offer.
Comments