Communicating with Twitter via Twitter4J using Scala

Twitter4J is a Java library for the Twitter API. With Twitter4J, you can easily integrate your Scala application with the Twitter service.

Twitter4J is featuring:

– Easy to use with Scala (as it works on any Java Platform version 5 or later)
– Support via a single jar file.
– Built-in OAuth support.

Here is the tutorial to use Twitter4J in Scala.

1. Download the Twitter4J jar file here.

2. Setup the TwitterFactory Object with your Twitter application credentials.

3. Thats it ! .Now we are ready to interact with Twitter.

Posting a Tweet :

Capturing the Tweets from your timeline :


Sending direct messages to recipients :

Querying the Twitter :

Getting Direct Messages :

& much more…..

There are several more methods present for a complete interaction with Twitter. Find more

Here’s the Scala code file :

Leave a Reply

%d bloggers like this: