13

Hitting the url http://twitter.com/home?status=<status_msg> takes us to the twitter login page and once logged in, the status is already filled in the input box, ready to be tweeted.

Is there a similar url for following somebody on twitter ?

something of the form http://twitter.com/follow?user=<user_to be_followed> so that when this url is hit, the user is taken to login page(if not authenticated), and after a successfull login, the logged in user becomes a follower of the user in the url.

Cœur
  • 37,241
  • 25
  • 195
  • 267
letronje
  • 9,002
  • 9
  • 45
  • 53
  • I don't know, but it's probably a bad idea without asking the user first. It's better to just link to the profile and let the user follow it themselves. – jtbandes Jan 13 '10 at 08:37

5 Answers5

14

I got information from https://dev.twitter.com/docs/intents#follow-intent and now you can use https://twitter.com/intent/user?screen_name=<twitter_screen_name>

khalifavi
  • 176
  • 1
  • 6
7

https://twitter.com/intent/follow?screen_name=[USERNAME]

in fact, there's a few 'intent', this one is particularly useful

https://twitter.com/intent/tweet?text=[TITLE]&url=[URL]

it is much better to use simple links like these for all sharing buttons than the buttons provided by the social sites which will multiply HTTP requests alarmingly.

Chris Pink
  • 1,558
  • 1
  • 15
  • 28
2

You could use OAuth. That will direct the user to Twitter for authentication and to authorize your app to act on their behalf. It will then give you a token that you can use to make API calls for that user.

It's not a terribly simple thing to implement and might be more trouble than it's worth for your situation, but the option is there. Look for a library for your platform of choice, they exist for most languages.

Jason Diller
  • 3,360
  • 2
  • 24
  • 25
0

I believe it's feasible, but not with a simple url -- you will need to POST data as directed in the friendships/create method of the Twitter API:

Allows the authenticating users to follow the user specified in the ID parameter. Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.

artlung
  • 33,305
  • 16
  • 69
  • 121
  • I dont want to ask the user for his/her username and password. I want the user to be authenticated by twitter itself. Looks like there is no available url to do that ! – letronje Jan 13 '10 at 09:26
0

You can't create a link like "follow us!". You can use the Twitter API to make a link that when clicked does the right POST call to the API, but there's no way to obtain a simple link like you asked.

napolux
  • 15,574
  • 9
  • 51
  • 70