Slack bot for Phabricator Notifications
NOTICE: The solution mentioned in this post no longer works because Slack has closed down the IRC gateway. I recommend using the phabulous project for this now.
Phabricator is a collection of open source web applications useful for software development built on a single platform. We have been using phabricator tools for about a month now, and it seems great. The best thing is: all different components (code review, task/bug tracking, project management, repo browsing) are well-integrated with one another, and work really well together.
Except one thing, of course, and that is it's chat app (called Conpherence). This is what they say about it themselves:
Like Slack, but nowhere as good. Seriously, Slack is way better.
Well, we use Slack ourselves in our organization, and I tried to find out a way to integrate phabricator with slack.
My use case was something like this:
- There are project specific channels (rooms?) in our slack
- Important updates related to a project should be auto-posted to this channel
- Discussions in this channel regarding the project should be enhanced by auto-linking of task ids or code review ids mentioned, to their URLs.
I found a few different ways:
Phabricator bots on github
There are a couple of projects on github which integrate phabricator with slack:
Both of these are good solutions for point 2 above, but don't (currently) solve point 3. A way to go forward would be to contribute new features to these projects.
Phabricator's in-built chatbot
Phabricator already has the concept of a chatbot which connects to IRC.
This bot covers both points 2 and 3 from my requirement, and also has some extra features, like recording chatlogs which can be browsed in the Phabricator web interface, which can in turn be referred to in comments for tasks, etc.
Slack has an IRC gateway which can be used for this purpose.
But the phabdev article on chatbot has an omnious note:
NOTE: The chat bot is somewhat experimental and not very mature.
Digging a little further, I found this task: T7829: PhabricatorBotFeedNotificationHandler is completely broken and unusable, which has one piece of bad news in the comments:
@epriestley: Bot stuff is generally a very low priority and I don't expect to review or merge any of it for a long time (roughly, around the Bot/API iteration of Conpherence, which is months/years away).
To make it work, @staticshock posted some fixes.
I made some changes of my own to make the bot filter the feed by project, so that one channel gets updates for only one or some of the projects.
My final diff can be found here: https://secure.phabricator.com/P1839.
And, my sample bot config is shared below:
We have to pass a list of project PHIDs in notification.projects
.
The way forward
So, the version shared above works fine for me, for now. Currently, it does not support connecting to multiple channels, having different config per channel, detecting projects for things other than tasks, ability to enter project name instead of PHID in config file, etc. These are some things I would want to add to my patch in the future.
Also, another good solution to all this would be to extend the chatbot code in phabricator in a generic way to be able to support bots for different services like slack, telegram, hipchat, etc.
Interactions