Perl bot to interact with Twitter via Jabber.

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
  • Switch
  • URI::Find

On Debian based systems you may want use the following command line:

aptitude install libnet-jabber-bot-perl libnet-twitter-perl libtimedate-perl libdatetime-format-dateparse-perl libdatetime-format-strptime-perl libhtml-html5-entities-perl libhtml-entities-numbered-perl libdata-dump-perl libswitch-perl liburi-find-perl curl

If you cannot find these packages in your distribution’s repository you’ll have to install them manually. 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
  3. Set up a Twtitter account at
  4. Fill in your Jabber credentials and serversettings in `j-vs-t.conf`
  5. Create a new Twitter App at
  6. Store in your access tokens in `j-vs-t.conf`
  7. Store your consumer key and secret in `` 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

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
!retweet [ID]
retweet message with id ID (last number in jabber message)
!favorite [ID]
favorite message with id ID (last number in jabber message)

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 GitHub. The latest sources can be obtained from

git clone

Martin Scharm

stuff. just for the records.

Do you like this page?
You can actively support me!

Leave a comment

There are multiple options to leave a comment: