Jabber -vs- Twitter

Perl bot to interact with Twitter via Jabber.

Jabber -vs- Twitter

Fig. 1: Jabber -vs- Twitter

This bot is sending you news from Twitter to your Jabber account and sending status updates from Jabber to Twitter. It’s free, open source and after some setup it’s very easy to use!
A sample usage of interact with the bot from Gajim can be seen in figure 1.


The following Perl modules should be installed:

  • Net::Jabber::Bot
  • Net::Twitter
  • Date::Parse
  • HTML::Entities
  • DateTime::Format::Strptime
  • Data::Dumper
  • curl

If you can’t find these packages in your distributions repository you’ll have to install them by hand. Example for installing Net::Jabber::Bot

perl -MCPAN -e shell
cpan[1]> install  Net::Jabber::Bot


All configuration stuff is located in j-vs-t.conf.

  1. copy src/j-vs-t.conf.sample to src/j-vs-t.conf
  2. Set up a Jabber account. Some popular servers can be found at http://www.jabberes.org/servers/.
  3. Set up a Twtitter account at http://twitter.com/
  4. Fill in your Jabber credentials and serversettings in j-vs-t.conf
  5. Create a new Twitter App at https://dev.twitter.com/apps
  6. Store in your access tokens in j-vs-t.conf
  7. Store your consumer key and secret in j-vs-t.pl in $APPKEY and $APPSECRET

It’s quiet obvious to me that the setup is more or less confusing. So don’t be afraid to ask me for help.


Just run the script with

perl -w j-vs-t.pl

from wherever you want. All you need is Perl and a internet connection.

For the first time you are asked to visit a website to authenticate. This website will offer a pin to you, provide it to this bot and see how fine it works.

White the tool is running it sends status updates in your Twitter time line as messages to the authorized account. Replies and retweets are send separately.

Each message that arrives from the authorized user to the Jabber account the bot is listening on will be send to Twitter as status update. But keep in mind
to leave them shorter than 140 chars, otherwise the bot won’t send it and gives you an reply informing you about your failure.

In addition you can send some command to the bot. These command start with an exclamation mark (!). Each message starting with ! is expected to be a command.

The following commands are available:

list of available commands
!follow [USER]
follow the user USER
!unfollow [USER]
stop following the user USER
!profile [USER]
print the profile of USER
list the users you are following
list the users that follow you

If the following error occurs you should check the credentials of the Jabber user:

Failed to re-connect: error


You can download this tool from SourceForge.
The latest version can be found in the git repository at


Leave a Reply