C.J. Scarlett

Slack IRC Gateway Authentication with irssi

Slack Logo

Preamble

Slack’s web interface isn’t too shabby, but at times it’s more preferable and easier to instead have a command line alternative. Also when working on a server or command line orientated environment, you might not have access to a web browser to login to Slack. So running an IRC client with access to the gateway provided, is the supported solution and remedy for this. The rest of this post shows one relatively straight forward way of using irssi IRC chat client to connect and authenticate with the gateway.


1 – Enable IRC on Slack Team

In the Slack team’s web browser session navigate to:

Team settings > Permissions > Gateways > Expand

Tick “Enable IRC gateway (SSL only)” and then click Save Settings.

Slack Tick-boxes

XMPP as pictured can also be enabled here for services such as Jabber


2 – Install irssi

Arch Linux

The simplest most accessible way is by using the system’s package manager:

1
$ sudo pacman -S irssi

Debian / Ubuntu

The simplest most accessible way is by using the system’s package manager:

1
$ sudo apt-get install irssi

3 – Run irssi

Here are two methods, either on its own:

1
$ irssi

Or in a screen session:

1
$ screen -S irssi-irc-client irssi

4 – Slack Team Gateway Credentials

Navigate to the new page that contains your team’s Slack gateway credentials.

Account & Profile > Settings tab > Gateways > Gateway configuration
Here are the details you need for the next few steps in order to setup IRC authentication to the Slack team.

Slack Gateway Details

Refer back to them as needed for these next steps.


5 – Add Slack Network Details

Where <slack-username> is your Slack username, and loy-slack is the name you want the network to be remembered as.

1
/network add -nick <slack-username> loy-slack

6 – Add Slack Server Details

Now add the server details to the network defined in the previous step, the command to do this comes next. Remember to replace loy-slack with the name you gave the network, and substitute the details from your Slack team’s IRC credentials into the command.

1
/server add -auto -ssl -network loy-slack <slack-teamname>.irc.slack.com 6667 <slack-password>

7 – Save Default Slack Channels

Entering this command will ensure irssi always joins the channel and network name whenever you connect to the server:

1
/channel add -auto #general loy-slack

8 – Save Configuration

Save all changes to the irssi configuration file in your user’s Linux home directory.

1
/save

Then quit the program:

1
/quit

9 – Run irssi

Once again run the program as down in the earlier step:

1
$ irssi

Or in a screen session:

1
$ screen -S irssi-irc-client irssi

The below output or similar appears upon launch of irssi:

1
2
3
4
5
6
7
8
9
10
11
12
13
3:43 -!- Irssi: Looking up <slack-teamname>.irc.slack.com
13:43 -!- Irssi: Connecting to <slack-teamname>.irc.slack.com [52.6.30.134] port 6667
13:43 -!- Irssi: Connection to <slack-teamname>.irc.slack.com established
13:43 slackbot [] requested CTCP VERSION from <user-name>:
13:43 -!- IRC-SLACK gateway
13:43 -!- Welcome to Slack IRC Gateway server <user-name>!~<user-name>@10.0.23.98
13:43 -!- MAP SILENCE=15 WHOX WALLCHOPS WALLVOICES USERIP CPRIVMSG CNOTICE MODES=6 MAXCHANNELS=100 SAFELIST are supported by this server
13:43 -!- NICKLEN=32 TOPICLEN=160 AWAYLEN=160 CHANTYPES=# PREFIX=(ov)@+ CHANMODES=b,k,l,rimnpst CASEMAPPING=rfc1459 are supported by this server
13:43 -!- there are 11 users
13:43 -!- Message of the day
13:43 -!- WELCOME TO SLACK...
13:43 -!- End of MOTD command
13:43 -!- Mode change [] for user <user-name>:+i

The persistent Slack connection is now setup and will be active each time you run irssi.


More Information

Easily deploy an SSD cloud server on Digital Ocean in 55 seconds. Sign up using my link and receive $10.00 in free credit: https://www.digitalocean.com/?refcode=e91058dbfc7b

– Scarlz: @5car1z