Slack IRC Gateway Authentication with irssi By DroidRant Editors February 11, 2020 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.
- Slack is where work flows. It's where the people you need, the information you share, and the tools you use come together to get things done.
- From the beginning, Slack had purposefully set out to create an experience that felt different than traditional email or IRC. In particular, Slack’s lively, colorful aesthetic set the product apart from the drab, utilitarian interfaces of competing products by companies like Microsoft.
WeeChat is a text based chat client that runs on manydifferent platforms like Linux, Mac OS X, various BSD variants and Windows(through cygwin). WeeChat is mainly used forIRC, aims to be fast, lightand extensible and is a more modern alternative toIRSSI.
After switching from Campfire to Slack for the thoughtbotcompany chat, more of us started using WeeChat together with the Slack IRCgateway.
Installing WeeChat
WeeChat can be installed either on your local machine or on a server.
Installing WeeChat on a server lets you always be online, even when you are notat your computer. This means that you will never miss a message in the channelsyou are connected to or any direct message or mention.
For instructions on installing WeeChat on a server check out the post RunningWeeChat on a Server for IRCBacklogs.
Binary packages for the latest version of WeeChat are available for a bunch ofdifferent distributions like Debian(Backports) and ArchLinux. Installationis as simple as using your favorite package manager.
WeeChat is also available through Homebrew as
weechat
. Wheninstalling using Homebrew be sure to pass these options to enable script supportfor Lua, Perl, Python and Ruby scripts:For instructions specific to your distribution check out the WeeChat user’sguide.
Connecting to Slack
First, get WeeChat up and running:
Then, add and connect to the Slack IRC gateway by issuing these commands insideof WeeChat:
Where:
NAME
is the name you want WeeChat to use when referring to this server.HOST
is theHost
as provided on the Gateways page.PASSWORD
is thePass
as provided on the Gateways page.USERNAME
is theUser
as provided on the Gateways page.NICK
is your Slack username.
This command turns on the autoconnect feature, SSL encryption and sets theDiffie-Hellmankey size to
512
. This is required since the WeeChat defaultvalue (2048
) will cause errors during the SSL handshake with the Slack IRCgateway.When you connect, the Slack IRC gateway will automatically join all channelsthat you already belong to.
Joining channels
If you want to join an existing channel or want to create a new one, use the
/join
command:Switching between buffers
In WeeChat, channels, private messages and connections to servers are displayedin what’s called buffers. By default WeeChat only displays one buffer at atime.
You can cycle between all open buffers by pressingAlt+Up/Down.
You can also switch between buffers using the
/buffer
command:Partial buffer names can be tab-completed.
Buffers are also numbered. You can jump between buffers using these numbers bypressing Alt+NUMBER or Esc and thenNUMBER. To get a better overview of open buffers and their numbers,check out the
buffers.pl
plugin.Buffers that have unseen activity are listed in thehotlist.To jump to the next buffer on the hotlist, pressAlt+A. The hotlist is ordered by importance.
Leaving channels
To leave a channel use the
/part
command. If you also want to close thecurrent buffer use the /close
command instead.Sending direct messages
To send a direct message to another user, use the
/query
command:This will open a new buffer with your conversation.
The core buffer
The first buffer (buffer number 1) is the WeeChat core buffer. This buffer isused to interact with WeeChat and all servers you are connected to. When youissue commands like
/help
or /whois
the output shows up in this buffer.When you issue commands in the core buffer they get sent to its current target.The current target is either WeeChat itself or one of the servers you areconnected to. You can see the current target on the line just above the bufferinput field. To cycle between targets pressCtrl+X.
When issuing commands to WeeChat itself you don’t have to switch to the
weechat
target.Configuring WeeChat
WeeChat is configured by issuing commands like
/set
, /unset
, /server
or/window
. To get information about a command use the /help
command like this:Where
COMMAND
is the command you want information about.If you issue the
/help
command without passing a command it will show you alist of all available commands.WeeChat’s configuration is stored in files inside the
~/.weechat/
directory.To save the current configuration to disk use the /save
command. To writethe current layout configuration to disk use the /layout save
command.The current configuration is automatically saved to disk by WeeChat when youquit or certain other WeeChat commands. This prevents you from loosing yourconfiguration but can also be a pain if you try to edit the files manually whileWeeChat is running.
Configuring highlights
By default all messages containing your nickname will be highlighted. You mightwant other messages to be highlighted as well. For example, if you would likeall messages that mention the word “fika” to be highlighted you can configurethat by typing:
Remote desktop osx to windows. Current: Configure Remote Desktop From MacOS to Windows Configure Remote Desktop From MacOS to Windows. Instructions to establish a remote connection, or screen sharing session, with an on-campus Windows machine from an OSX machine. On-Campus machine must be powered on and connected to the network; Microsoft Remote Desktop.
Slack Irc Client
Tell WeeChat to highlight messages containing other words by separating themwith commas:
Filtering out voice mode change messages
The Slack IRC gateway uses the IRC voice feature to indicate user activity. Auser is automatically voiced when active and devoiced when inactive. Users thatare using the Slack web interface are constantly voiced and devoiced and thiscreates a lot of noise in WeeChat buffers. To filter out these messages you canadd this filter:
Where
NAME
is the name of your server in WeeChat.Add more nickname colors
By default WeeChat only uses a handful of colors to color the nicknames inbuffers. In channels with a lot of people this can become confusing. Thiscommand lets WeeChat use a couple more colors:
To review what colors you are using you can use the
/color
command.If you are running WeeChat in GNU Screenit is important that the
TERM
environment variable is set to screen-256color
in order for WeeChat to be able to display all the above colors. You can forcethis by adding this line to your .screenrc
:Scripts
WeeChat is extensible through scripts written in an array of differentlanguages. Scripts are listed on the Script section of the WeeChatwebsite.
You can also browse listed scripts inside WeeChat using the
/script
commandwithout any arguments:This will open an interactive buffer where you can browse, install, remove andload scripts.
Below I walk you through installing some scripts that I find usable in generaland some with Slack in particular.
Buffers
Buffers provides a sidebarwhere all open buffers are listed with their number. This gives me a much betteroverview of my buffers. The sidebar also shows which buffers has unread messagesand highlights.
Install Buffers using the
/script
command:By default Buffers will color the buffer names depending on activity inthem. If you also want to know how many messages and highlights the buffers haveyou can tell Buffers to display a hotlist counter:
Interactive set
Navigating through all the different WeeChat configuration options can be hard.Interactive set lets you setconfiguration options interactively.
Install Interactive set using the
/script
command:When you use the
/iset
command a buffer with all options is opened. Navigatethe list by using your arrow keys or PgUp or PgDn.Highmon
Highmon is a highlightmonitor. It creates a buffer containing all highlighted messages in otherbuffers. This script is great for quickly reviewing all my mentions to see ifsomething important has come up.
Install Highmon using the
/script
command:![Slack irc plugin Slack irc plugin](/uploads/1/1/7/7/117774260/116745020.jpg)
I keep a small Highmon buffer at the top of my WeeChat window at all times. Thisway, I just have to glance at the WeeChat window to see I have any new importanthighlights.
To do this, split your window into two horizontal splits; One small at the topfor Highmon, and one large below for your chat buffers:
Slack Irc Download
Save this layout to disk to persist it during restarts:
Slacklog
Slacklog (written by fellowthoughtbotter Pat Brisbin) pulls chat history from the Slack API and prints itinto the buffer as backlog whenever you join a new channel.
Since Slacklog is not yet published on the WeeChat website you have to installit from your shell:
Load it in WeeChat:
Create an API token on the Slack API website andconfigure Slacklog with your Slack server and API token:
Where:
NAME
is the name you gave your Slack IRC server.TOKEN
is the token as specified on the Slack APIwebsite.
By default, Slacklog pulls in the 100 latest messages. If you want to changethis number you can set it to a value between
1
and 1000
using this option:Colorize Lines
Colorize Lines letsme color messages in the same color as the nicknames of the users that postedthem. This helps me distinguish between messages more easily.
Install Colorize Lines using the
/script
command:Slack Home Page
Messages posted from now on will be colorized.
Slack-irc Freenode
Auto loading scripts
Slack Irc Account
Scripts can be auto loaded by WeeChat on startup. To tell WeeChat to auto loada script use the
/script
command: