Tricks Of The Trades

Slack IRC Gateway Authentication with irssi

Pinterest LinkedIn Tumblr

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.

Read this: Installing Fail2ban on Ubuntu 18.04 (Bionic Beaver)

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 gateways

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 irc

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> 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. 3:43 -!- Irssi: Looking up <slack-teamname>
  2. 13:43 -!- Irssi: Connecting to <slack-teamname> [] port 6667
  3. 13:43 -!- Irssi: Connection to <slack-teamname> established
  4. 13:43 slackbot [] requested CTCP VERSION from <user-name>:
  5. 13:43 -!- IRC-SLACK gateway
  6. 13:43 -!- Welcome to Slack IRC Gateway server <user-name>!~<user-name>@
  8. 13:43 -!- NICKLEN=32 TOPICLEN=160 AWAYLEN=160 CHANTYPES=# PREFIX=(ov)@+ CHANMODES=b,k,l,rimnpst CASEMAPPING=rfc1459 are supported by this server
  9. 13:43 -!- there are 11 users
  10. 13:43 -!- Message of the day
  11. 13:43 -!- WELCOME TO SLACK…
  12. 13:43 -!- End of MOTD command
  13. 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.

Write A Comment