Since I run irssi all the time, packing as many features into it as possible seems like a nice idea.

So I use bitlbee to connect to Messenger, Google Talk/Jabber and ICQ and I have been using tircd (Twitter/irc gateway) and tweet.im (Twitter/Google Talk gateway) to connect to Twitter; but none of them works like I want them to.

Today I stumbled across Twirssi, a script for irssi to interact with Twitter.

Out of the box twirssi expects input to be UTF-8 which caused some grief because my terminal is ISO-8859-15.

First, lets install required modules for twirssi

I run Ubuntu Karmic Koala so Net::Twitter is available as a package

$ sudo apt-get install libnet-twitter-perl

If you run an older Ubuntu release or another Linux/Unix variant that does not have a native package, install it from CPAN (I will not go into the configuration of CPAN here – have a look at this article for more information).

$ sudo perl -MCPAN -e shell
cpan[1]> install Net::Twitter

Answer yes to all dependencies.

Next step is to install a Perl module for the URL shortening service you wish to use; I use Bit.ly so let’s install the module

$ sudo perl -MCPAN -e shell
cpan[1]> install WWW::Shorten::Bitly

Now, let’s install twirssi

Head to irssi’s scripts directory

$ cd ~/.irssi/scripts

Download the script

$ wget http://twirssi.com/twirssi.pl

Make sure the script is autoloaded at startup

$ cd autorun
$ ln -sf ../twirssi.pl .

Patch twirssi to support other charsets than UTF-8

$ cd ~/.irssi/scripts
$ wget http://people.freebsd.org/~garga/patches/twirssi_charset.diff
$ patch -p1 < twirssi_charset.diff

Finally, configure twirssi

The configuration is done from inside irssi

  1. Create a new window for twirssi
    /win new hidden
  2. Name the new window
     /win name twitter
  3. Optional: Move the new window to another location
    /win move <number>
  4. Optional: Save new window layout
    /layout save
  5. Load twirssi
    /script load twirssi.pl
  6. Configure URL shortening service
    /set short_url_provider Bitly

    /set short_url_args "Bitly API key"
  7. Configure Twitter usename
    /set twitter_usernames Your_Twitter_Username

    /set twitter_passwords Your_Twitter_Password

    (Note: This will store your Twitter password in clear text in irssi’s configuration)

  8. Set charset to use
    /set twirssi_charset ISO-8859-15
  9. Reload the script to pickup autologin to Twitter
    /script load twirssi.pl

More information on how to use twirssi is available here