What Really IRCs Me: Slack
Find out how to reconnect to Slack over IRC using a Bitlbee libpurple plugin.
I'm an IRC kind of guy. I appreciate the simplicity of pure text chat, emoticons instead of emojis, and the vast array of IRC clients and servers to choose from, including the option to host your own. All of my interactive communication happens over IRC either through native IRC channels (like #linuxjournal on Freenode) or using a local instance of Bitlbee to act as an IRC gateway to other chat protocols. Because my IRC client supports connecting to multiple networks at the same time, I've been able to manage all of my personal chat, group chat and work chat from a single window that I can connect to from any of my computers.
Before I upgraded to IRC, my very first chat experience was in the late 1990s on a web-based Java chat applet, and although I hold some nostalgia for web-based chat because I met my wife on that network, chatting via a web browser just seems like a slow and painful way to send text across the internet. Also, shortly after we met, the maintainers of that network decided to shut down the whole thing, and since it was a proprietary network with proprietary servers and clients, when they shut it down, all those chat rooms and groups were lost.
I'm part of a few Slack networks, and up until recently, I honestly didn't think all that much about Slack, because unlike some other proprietary chat networks, Slack had the sense to offer IRC and XMPP gateways. This meant that you weren't required to use its heavy web app, but instead, you could use whatever client you preferred yet still connect to Slack networks. Sure, my text-based IRC client didn't show animated Giphy images or the 20 party-parrot gifs in a row, but to me, that was a feature. Unfortunately, Slack could no longer justify the engineering effort to backport web chat features to IRC and XMPP, so the company announced it was shutting down its IRC and XMPP gateways.
When Slack first announced it was shutting down the IRC gateway, I wasn't sure what I would do. I knew that I wouldn't use the web app, so I figured if an alternative didn't come around, I'd just forget about the Slack networks I was a part of, just like when that old Java chat shut down. Fortunately, the FLOSS community saved the day, and someone wrote a plugin that uses the libpurple library (a kind of Rosetta stone plugin framework for chat used by programs like Pidgin and Bitlbee to allow access to ICQ, MSN, Yahoo and other dead proprietary chat networks). Although using the direct IRC gateway was easier, setting this up on Bitlbee wasn't so bad. So, in this article, I describe how to do exactly that.
Why Not Weechat?
I know that many console-based chat fans have switched to Weechat as their IRC client, and it has a native Slack plugin. That's great, but I've been using Irssi for something like 15 years, so I'm not about to switch clients just for Slack's sake. Anyway, with the Bitlbee program, you can connect to Slack using your preferred IRC client whether that's Irssi, Xchat or even MIRC (no judgment).
Install the Slack libpurple Plugin for Bitlbee
Since the Slack Bitlbee plugin uses libpurple, the first step is to make sure you install a Bitlbee package that has libpurple built in. On Debian-based distributions, this means replacing the basic bitlbee package with bitlbee-libpurple if you don't already have it installed. This package should set up a local network service listening on the IRC port automatically. I cover how to use Bitlbee in detail in my past article "What Really IRCs Me: Instant Messaging", so I recommend you refer to that article for more details.
Once you are connected to Bitlbee, you should be able to issue a
purple command and get a list of existing libpurple plugins that it has
19:23 @greenfly| help purple 19:23 @ root| BitlBee libpurple module supports the ↪following IM protocols: 19:23 @ root| 19:23 @ root| * aim (AIM) 19:23 @ root| * bonjour (Bonjour) 19:23 @ root| * gg (Gadu-Gadu) 19:23 @ root| * novell (GroupWise) 19:23 @ root| * icq (ICQ) 19:23 @ root| * irc (IRC) 19:23 @ root| * msn (MSN) 19:23 @ root| * loubserp-mxit (MXit) 19:23 @ root| * myspace (MySpaceIM) 19:23 @ root| * simple (SIMPLE) 19:23 @ root| * meanwhile (Sametime) 19:23 @ root| * jabber (XMPP) 19:23 @ root| * yahoo (Yahoo) 19:23 @ root| * yahoojp (Yahoo JAPAN) 19:23 @ root| * zephyr (Zephyr) 19:23 @ root|
Note that Slack isn't yet on this list. The next step is to build and install the Slack libpurple plugin on your machine. To do this, make sure you have general build tools installed on your system (for Debian-based systems, the build-essential package takes care of this). Then install the libpurple-devel or libpurple-dev package, depending on your distro. Finally, pull down the latest version of the plugin from GitHub and build it:
$ git clone https://github.com/dylex/slack-libpurple.git $ cd slack-libpurple $ sudo make install
(Note: if you don't have system-level access, you can run
sudo make install to install the plugin locally.)
Once the install completes, you should have a new library file in /usr/lib/purple-2/libslack.so. Restart Bitlbee, and you should see a new plugin in the list:
19:23 @greenfly| help purple 19:23 @ root| BitlBee libpurple module supports the ↪following IM protocols: 19:23 @ root| 19:23 @ root| * aim (AIM) 19:23 @ root| * bonjour (Bonjour) 19:23 @ root| * gg (Gadu-Gadu) 19:23 @ root| * novell (GroupWise) 19:23 @ root| * icq (ICQ) 19:23 @ root| * irc (IRC) 19:23 @ root| * msn (MSN) 19:23 @ root| * loubserp-mxit (MXit) 19:23 @ root| * myspace (MySpaceIM) 19:23 @ root| * simple (SIMPLE) 19:23 @ root| * meanwhile (Sametime) 19:23 @ root| * slack (Slack) 19:23 @ root| * jabber (XMPP) 19:23 @ root| * yahoo (Yahoo) 19:23 @ root| * yahoojp (Yahoo JAPAN) 19:23 @ root| * zephyr (Zephyr) 19:23 @ root|
Configure Slack in Bitlbee
Once you have the Slack module set up, the next step is to configure it like any other Bitlbee network. First, create a new Bitlbee account that corresponds to your Slack account from the Bitlbee console:
account add slack firstname.lastname@example.org
Next, you'll need to add what Slack calls a Legacy API token, which tells me at some point Slack will deprecate this and leave us out in the cold again. To do this, make sure you are logged in to Slack in your web browser, and then visit https://api.slack.com/custom-integrations/legacy-tokens. On that page, you will have the ability to generate API tokens for any Slack networks where you are a member. Once you have the API token, go back to your Bitlbee console and set it:
account slack set api_token xoxp-jkdfaljieowajfeiajfiawlefje account slack on
If this is the only Slack account you have created, it will label it as
"slack", and you can refer to it that way. Otherwise, you'll need to type
account list in the Bitlbee console and see how Bitlbee numbered your slack
account, and then replace
slack in the above commands with the number
associated with that account.
Unfortunately, unlike with the IRC gateway, this plugin doesn't
connect you to any channels in which you are active automatically. Instead, once your Bitlbee
client connects, you need to tell Bitlbee about any particular channels
you want to join. You can do this with the standard Bitlbee
chat add command. So for
instance, to add and join the #general channel most Slack networks have, you
chat add slack general /join #general
Note that like with the other previous commands, you may need to replace
with the number associated with your account if you have multiple Slack
If you want Bitlbee to rejoin a particular room automatically whenever you connect, you can type:
channel general set auto_join true
Repeat this for any other channels you want to auto-join.
Okay, so maybe this article was a little bitter compared to others I've written. I can't help it. It really bothers me when companies use their control over proprietary software, networks or services to remove features upon which people depend. I've also seen so many proprietary chat networks come and go while IRC stays around, that I just wish people would stick with IRC, even if they don't get the animated smiley emoji that turns around in a circle. I'm very thankful for a solid community of developers who are willing to pore through API docs to build new third-party plugins when necessary.
Limited Time Offer
Take Linux Journal for a test drive. Download our September issue for FREE.
Topic of the Week
The cloud has become synonymous with all things data storage. It additionally equates to the many web-centric services accessing that same back-end data storage, but the term also has evolved to mean so much more.