Integrating Ghost with Slack

The Research and Development team at Kompiler brings you yet another feature! The team has been hard at work integrating our Kompiler blog powered by Ghost with the Pilsprog Slack group.

So how did the team achieve this? There was some discussion about what would be the best approach. One thought was to introduce a customised Ghost Casper theme where we would insert some JavaScript code into the theme that would pick up post submits and then post them to the Slack group. This would probably work, but felt very hacky and would require the custom theme to be maintained by merging in new changes from the default casper theme into the customised one. Another approach would be to use the app API being developed for the Ghost Blog platform. Unfortunately this API is far from done.

Fortunately the RSS feed standard came to the rescue. We could create a super-simple server that would poll the Kompiler.no rss feed, and when detecting new posts would post a message to a Slack webhook. A super simple solution that had the nice bi-effect of being generalisable. RSS feeds are in their very nature generic, so an RSS feed polling server that notifies Slack can be used on any RSS feed and Slack channel really. Great!

This being Kompiler we ofcourse opted to implement the thing in Node.js using CoffeeScript. Not because we could not do it in another language, but because Node is very lightweight and easy to do web stuff with. The Node eco system is pretty great in terms of packages as well, and a ready to go RSS feed watcher package was available through the npm package manager.

The end result was a super simple generic rss-slack-integration package and a wrapper Node project to use this package for the Kompiler Ghost blog and our Slack group. The npm package weighs in at about 20 code lines, but it is my hope that it might be useful for anyone looking to have an rss feed update in their Slack channel.

Feel free to submit pull requests or file issues at the rss-slack-integration Github repository.