How to accept follow request via API

8 views
Skip to first unread message

daniello

unread,
Jan 14, 2009, 8:04:08 AM1/14/09
to Twitter Development Talk
Hi,

The problem:

User A has his updates protected. User B has his updates public.
There is no relation between these users yet. I need to send the
direct message from user A to user B. I have credentials of both
users. What API invocations should I execute in order to be able to
send direct messages from user A to B. (ie how to accept the follow
request by API)

Thanks in advance,
Daniello

Abraham Williams

unread,
Jan 14, 2009, 9:03:15 AM1/14/09
to twitter-deve...@googlegroups.com
Call http://apiwiki.twitter.com/REST+API+Documentation#create as user B to friend user A.

Then call http://apiwiki.twitter.com/REST+API+Documentation#new as user A to send a DM to user B.
--
| Abraham Williams | Web Developer | http://abrah.am
| Web608 | Community Evangelist | http://web608.org
| gg&d | betaGeek | http://girlsgeeksanddating.com
| Micro-email: http://userscripts.org/scripts/show/38822
| This email is: [] blogable [x] ask first [] private

Daniel Kwiecinski

unread,
Jan 14, 2009, 9:20:52 AM1/14/09
to twitter-deve...@googlegroups.com
Ok, I did the following according your advice:

1.)

curl -u user_b:pass_b -d "" http:nielllo.jsonm/friendships/create/user_a.json
{"description":"","screen_name":"user_a","url":null,"name":"user_a","protected":true,"profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/xxxx_o_normal.jpg","location":"London","id":xxxxxx,"followers_count":8}


2.)

curl -u user_a:pass_a -d "user=user_b&text=bla" http://twitter.com/direct_messages/new.json
{"request":"\/direct_messages\/new.json","error":"You cannot send messages to users who are not following you."}


And I've check the user_a twitter page, there is pending request from user_b but is not accepted.

Any ideas?
Daniello

2009/1/14 Abraham Williams <4br...@gmail.com>

Abraham Williams

unread,
Jan 14, 2009, 9:49:36 AM1/14/09
to twitter-deve...@googlegroups.com
I assumed that a protected user would be able to dm a requesting user but I guess not. 

You can repeat step one switching the users and then it will work.
--
| Abraham Williams | http://the.hackerconundrum.com

Daniel Kwiecinski

unread,
Jan 14, 2009, 11:40:35 AM1/14/09
to twitter-deve...@googlegroups.com
Following your advice I executed:

3.)

   curl -u user_a:pass_a -d "" http://twitter.com/friendships/create/user_b.json
   {"description":"","screen_name":"user_b","url":null,"name":"user_b","protected":false,"profile_image_url":"http:\/\/static.twitter.com\/images\/default_profile_normal.png","location":"","id":xxx,"followers_count":1}

but I can not send direct messages from user_a to user_b ;(

4.)

   curl -u user_a:pass_a -d "user=user_b&text=bla" http://twitter.com/direct_messages/new.json
{"request":"\/direct_messages\/new.json","error":"You cannot send messages to users who are not following you."}



Any ideas,

Damon Clinkscales

unread,
Jan 15, 2009, 1:04:33 AM1/15/09
to twitter-deve...@googlegroups.com
Until the "follow request" is approved by user A, B is not really
following A. Therefore A can't send a DM to B.

AFAIK, there's not a way to do the follow approval process step via
the API. That step is done in the Twitter UI.

-damon

Damon Clinkscales

unread,
Jan 15, 2009, 1:04:33 AM1/15/09
to twitter-deve...@googlegroups.com
Until the "follow request" is approved by user A, B is not really
following A. Therefore A can't send a DM to B.

AFAIK, there's not a way to do the follow approval process step via
the API. That step is done in the Twitter UI.

-damon

On Wed, Jan 14, 2009 at 10:40 AM, Daniel Kwiecinski
<daniel.k...@gmail.com> wrote:

Daniel Kwiecinski

unread,
Jan 15, 2009, 3:18:12 AM1/15/09
to twitter-deve...@googlegroups.com
OK, that's answers my question - it is not possible to establish a relation between 2 users via API in order to allow sending direct messages.

It arises question number two:
  Is it prohibited to pretend web GUI so my app will using pure HTTP will accept "follow request" ?

Thank you,
Daniello

2009/1/15 Damon Clinkscales <sca...@pobox.com>

Abraham Williams

unread,
Jan 17, 2009, 4:03:52 AM1/17/09
to twitter-deve...@googlegroups.com
Was the flow previously that by following someone you where approving them to follow you? Or has it always been the way it currently is?

cjmartin

unread,
Jan 30, 2009, 4:52:47 AM1/30/09
to Twitter Development Talk
This api call has been requested and accepted (although with a low
priority and milestone of V2, whenever that is) at
http://code.google.com/p/twitter-api/issues/detail?id=8&q=label:Type-Enhancement&colspec=ID%20Stars%20Type%20Status%20Priority%20Owner%20Summary%20Opened%20Milestone

Everyone else that wants it should go star it to remind them that it's
important to us.
> >> \/images\/default_profile_normal.png","location":"","id":xxx,"followers_cou nt":1}

Daniel Kwiecinski

unread,
Jan 30, 2009, 9:14:21 AM1/30/09
to twitter-deve...@googlegroups.com
Thanks for pointing this one.
Does anybody can comment on using requests to the Twitter website (not the API part) as a API. That would be a workaround to the issue.
Does it break the usage licence or any other Twitter's policy?

Regards,
Daniel

2009/1/30 cjmartin <cjma...@gmail.com>

Alex Payne

unread,
Jan 30, 2009, 2:59:26 PM1/30/09
to twitter-deve...@googlegroups.com
Don't scrape our site. Seriously. Our operations staff will blackhole your IP.

--
Alex Payne - API Lead, Twitter, Inc.
http://twitter.com/al3x

Gustavo Melo

unread,
Jan 30, 2009, 3:05:33 PM1/30/09
to twitter-deve...@googlegroups.com
lol
--
----------------------------------
Analista Desenvolvedor
www.espacodj.com

Daniel Kwiecinski

unread,
Jan 30, 2009, 4:41:07 PM1/30/09
to twitter-deve...@googlegroups.com
Are you blocking the whole TOR network?

Just kidding ;-)
Reply all
Reply to author
Forward
0 new messages