Tue Oct 28 19:38:00 CET 2008

Twitter2Jabber

Maybe as you noticed twitter shutted down their jabber services for a long time. The reason is that you couldn't have your friends updates in your jabber client anymore. Couldn't you really? Wait! There's something you should possible know. ;-)

Today I invented a little gateway between the twitter API and the xmpp protocol. To speak with a jabber server you need a new account and you need sendxmpp. It's as easy as writing mails with sendmail. sendxmpp could read from stdin and send it then to your jabber address. There is only one little missing feature: You could only send messages or send something to a chatroom. For example in psi a new message window will popup everytime you'll get a message.
If you have a look into /usr/bin/sendxmpp it's a simple perl script. On line 301 there begins a message block where the message is formed to be send to your jabber account. You need only to add after to, subject and body a 'type' => "chat". Then everytime you'll got a message from your sendxmpp client you will see it in a normal chat window. That's really cool.

But how do we get the twitter updates for you? There exists a little script with the name bash loves twitter: blt. On the first run you tell him your account name and your password and then everything will run fine. If you run it multiple times you'll see the updates of your friends on your bash shell.

The last step for you is to build a loop or a cronjob so that blt asks twitter for updates and pipes it through sendxmpp to your jabber account regularly.
But keep in mind that it is only a unidirectional channel. :-/
To put updated to twitter via a jabber window, please use identi.ca or the laconi.ca software at all.

Thanks for your patient.


Posted by Sebastian Wieseler | Categories: *nix |