For the longest time, my Digital Ocean droplet was used for random geeky things, such as a ZNC IRC bouncer, bitlbee, and a few other tools. Well, that changed when I decided to rebuild that droplet for bringing megalithic industries to life. I decided to wipe the droplet clean, and start from scratch; in the process, I lost all of my configurations (yikes).
Slackcat is a utility you can use to upload files or snippets to Slack or even just post from your command line. You can install it via RubyGems, using the method of your choice. I prefer RVM, but you can also install it system-wide. Configuring Weechat for Slack with wee-slack. Weechat configuration View Comments. Configuring Weechat for IRC and Slack.
So, that just means I have blog post content now; all in an effort to help others wanting to set up a modern day weechat command-line chat interface (complete with a ZNC server, bitlbee, and wee-slack).
By the end of this post, you’ll have a fully working weechat CLI interface setup on your local machine, that will give you the ability to hook into IRC (via your own ZNC IRC bouncer), bitlbee (for Google Hangouts, amongst other services), and finally, wee-slack (a great python script that allows for communications with Slack’s websockets API).
This article assumes that you have already setup and secured a Digital Ocean droplet.
ZNC
Let’s install ZNC and setup a user to run ZNC under. This also generates a config file for you. It will walk you through some defaults, and let you fill in important details. As part of those details, let’s go ahead and setup freenode as our initial IRC server, and remember the port you set for ZNC (we’ll assume 5000
).
Installation
Before we continue with setting up ZNC configs, let’s make sure it auto-launches anytime our droplet restarts..
First, create a systemd service: sudo vim /etc/systemd/system/znc.service
Use the following service config:
Reload the daemon and enable ZNC service
Configuration
With installation done we need to setup our main ZNC user and all of its config.
First, let’s try visiting the ZNC web config panel at http://<droplet_ip>:5000
.
From here you should be able to log in with the user and password you defined during initial ZNC setup.
Next, you’ll want to click the “Your Settings” link from the web interface. You can now easily change the password if you want, along with all the other settings for Freenode, including setting up the channels to always connect to. You can also setup nickserv
module to automatically identify you and your preferred nick. Dope!
Weechat
Last thing to do is setup weechat to connect to your ZNC server for all your IRC needs!
We’re going to assume you already have weechat installed on your OS of choice (for macOS: brew install weechat
).
From within weechat, we’re going to add a server for freenode, and set it up to auto-connect for us..
Assuming you setup the nickserv
module in ZNC, as well as some initial channels to connect to, it should just auto-connect and auto-join freenode and those channels. We’re done with ZNC/IRC.
Bitlbee
Now that we have IRC things taken care of with ZNC, let’s install bitlbee and libpurple so that we can get Google Hangouts working with weechat. We’ll need to use Mercurial for version control for connecting the dots between libpurple and hangouts. Finally, we’ll build the purple-hangouts project.
Installation
Before we get to configuring bitlbee further, let’s make sure it relaunches upon restarting our droplet.
Weechat Slack Plugin
First, create a systemd service: sudo vim /lib/systemd/system/bitlbee.service
Use the following service config:
Reload the daemon and enable bitlbee service
Configuration
Ok, let’s quickly configure our bitlbee instance: sudo vim /etc/bitlbee/bitlbee.conf
I prefer these settings:
Weechat
Configuration of bitlbee and purple-hangouts should be done, so now we just need to connect it up to weechat. We’re going to assume you already have weechat installed on your OS of choice (for macOS: brew install weechat
).
We’ll setup a hangouts server (could be called anything you want). Next we’ll connect to it, then we’ll register a super_secret_password. Lastly we’ll setup weechat to auto log us in each time.
Now we need to setup Google Hangouts for bitlbee/purple. Let’s do that now, while we have the &bitlbee buffer selected in weechat.
You’ll be presented with a private message from purple_request_0
. It prompts you to visit a YouTube video to watch to get the oauth_code
to respond with in the PM. Once you enter the oauth_code, you’re done, it’ll connect you.
Lastly we need to save our configs in weechat/bitlbee!
For bitlbee, while you’re still in the bitlbee buffer: save
For weechat, from any buffer: /save
Weechat Slack Sign In
Slack
The best way to connect to your various Slack groups is with a python weechat plugin called wee-slack. It supports real-time chat via websockets. This means that you will get a TON of amazing features like, typing notifications, emoji reaction support, interacting with your status, threads, and so much more.
Let’s get that all setup!
Installation
wee-slack has one system dependency, that is the python websocket pip plugin, to install on macOS: pip install websocket-client
.
Now that our dependency is installed, let’s get wee-slack installed, and symlinked to autoload when weechat starts up:
Configuration
As to not take away from the tireless work and documentation from the wee-slack contributors, I’m going to link you to their setup section for getting your Slack API token’s created and stored in weechat.
After you complete the API token creation and registration processes linked above, you’ll want to be sure to /save
within weechat to save all of this configuration.
Fin
That does it folks!
You now have a working ZNC IRC bouncer, and bitlbee server setup on your own Digital Ocean droplet. You also now have weechat setup on your local machine, complete with connectivity to IRC freenode via ZNC, Google Hangouts via bitlbee, and to Slack via wee-slack.
If you’d like to check out a fully working weechat setup, feel free to peruse my dotfiles. This is setup for my purposes, but should give a really good idea as to what all is possible.
Happy CLI chatting!
Links
Tagged: irc, slack, weechatSlack has gained a lot of popularity in recent times as a tool for inter-team communication and for the right reasons. It offers a lot of features such as 3rd party software integrations, rich content communication, collaboration, bots etc. which when put together help create a rich collaborative user experience for teams to work together, especially when they are not co-located, which is fairly common these days.
If you’re anything like me and have been around long enough to know what irc is and when you look at various elements that slack provides like channels, accounts (servers), private messaging, etc. you know that it draws a lot of parallels and inspiration from that old school communication tool.
However, slacks desktop application, which is build using electron, although is very feature rich, is extremely memory hungry for my liking. I have also experienced extreme slow downs / hang ups at times. For that reason, I have always been on the look out for a way to combine the rich user experience of slack with the simplicity of irc without compromising a lot on the goodness the app provides.
Slack has always offered an IRC gateway which can be enabled by a team admin, and then you can use any regular irc client to connect. However that means that I have to compromise on a lot of features, some very basic such as editing your own messages etc and also since it needs to be enabled explicitly by an admin, its not always available.
Recently I came across wee-slack which is a slack app built as a weechat plugin.
Since I had been using weechat already previously as my irc client (still do), this was perfect for me. After using it for a significant amount of time, I can say it is superb. It gives me the best of both worlds without compromise. It uses slack’s APIs and hence does not require an explicit IRC gateway feature to be enabled by an admin, moreover it gives a very text friendly API to leverage slacks features from within weechat. I would highly recommend using it as opposed to using the slack app since it is extremely light weight yet powerful.