Follow/Unfollow twitter account using Twitter4j

In my recent grails project, i worked on integrating twitter API with the grails application. In one of the requirements, we needed to show the tweets from user wall and show the profile of the person/account who posted that tweet. In the profile, the user should be able to Follow or Unfollow that person from his twitter account using our application interface. I used Twitter4j (a java wrapper for twitter API calls), to make API calls and implemented this functionality.

For making any twitter API calls we need to have twitter account access_token and access_secret, which we obtains after authorizing/connecting twitter account with the application as mentioned in this blog.