Weechat Setup With IRC, Bitlbee And Slack

Published on 2019-01-19
6min to read
weechat cli slack bitlbee dotfiles

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).

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.


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).


cd ~;
sudo apt install -y znc znc-dev;
sudo useradd --create-home -d /var/lib/znc --system --shell \
  /sbin/nologin --comment "User to run ZNC daemon" --user-group znc;
sudo -u znc /usr/bin/znc --datadir=/var/lib/znc --makeconf;

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:

Description=ZNC Service

ExecStart=/usr/bin/znc -f --datadir=/var/lib/znc


Reload the daemon and enable ZNC service

sudo systemctl daemon-reload;
sudo systemctl enable znc;


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!


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 (from weechat)..

/server add freenode <droplet_ip>/<port_for_znc> -autoconnect
/connect freenode

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.


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.


cd ~;
sudo mkdir -p /var/lib/bitlbee;
sudo apt-get install -y libpurple-dev libjson-glib-dev libglib2.0-dev \
  libprotobuf-c-dev protobuf-c-compiler git make;
mkdir src;
cd src;
git clone https://github.com/EionRobb/purple-hangouts \
  && cd purple-hangouts;
make && sudo make install;

Before we get to configuring bitlbee further, let’s make sure it relaunches upon restarting our droplet.

First, create a systemd service: sudo vim /lib/systemd/system/bitlbee.service

Use the following service config:

Description=BitlBee IRC/IM gateway

ExecStart=/usr/sbin/bitlbee -F -n


Reload the daemon and enable bitlbee service

sudo systemctl daemon-reload
sudo systemctl enable bitlbee


Ok, let’s quickly configure our bitlbee instance: sudo vim /etc/bitlbee/bitlbee.conf

I prefer these settings:

RunMode = ForkDaemon
User = bitlbee
DaemonInterface =
DaemonPort = 5001
AuthMode = Open


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 (from weechat).

/server add hangouts <droplet_ip>/<port_for_bitlbee> -autoconnect
/connect hangouts
/register <super_secret_password>
/set irc.server.hangouts.command "/msg &bitlbee /OPER identify <super_secret_password>"

Now we need to setup Google Hangouts for bitlbee/purple. Let’s do that now, while we have the &bitlbee buffer selected in weechat (from weechat).

acc add hangouts your-gmail-account@gmail.com
acc hangouts on

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


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!


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:

cd ~/.weechat/python
wget https://raw.githubusercontent.com/wee-slack/wee-slack/master/wee_slack.py
ln -sfv ../wee_slack.py autoload


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.


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!