Question

I'm new to the twitter API https://dev.twitter.com/docs/api and I would like to incentivize users on my website to follow me, or re-tweet me by giving them extra privileges on my site if they do. In order to do this, I need some type of confirmation after they have followed me, or retweeted, etc. Is this possible, or practical? If so can anyone point me in the right direction?

Was it helpful?

Solution

Yeah, that's reasonable. From their API Documentation (see #1), you can make a followers request, substituting USERNAME with your twitter username:

http://api.twitter.com/1/statuses/followers/USERNAME.xml?cursor=-1

I'd simply store that list of users and, when needed, make periodic new requests to find out if you have additional followers. It looks like it's in order from most recent to newest, so you'd likely only need to request a page or two.

In XPath notation, you'll be interested in the /users/user nodes, and perhaps specifically, /users/user/screen_name[text() = 'provided_username'].

Armed with that information, you can then tweek your website behaviors.

1: "http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses followers"

Note: markdown seems to break on the space in the above URL, and URL-encoding the space results in a 404.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top