6
votes

Need a way to post a comment on a friend's wall post through the Facebook API (I'm using the Python wrapper).

Consider two users, Alice and Bob. I have read_stream and write_stream permissions for both users.

>>> alice_graph = GraphAPI(alice_access_token)
>>> bob_graph = GraphAPI(bob_access_token)

# Alice makes a post on her own wall, which returns the objects Graph API id
>>> alice_graph.put_wall_post("test_message", attachment={'name' : 'some_name', 'link' : 'some_link')
{u'id': u'some_facebook_id'}

# Alice can comment
>>> alice_graph.put_comment('some_facebook_id', "test comment")
{u'id': u'some_other_facebook_id'}

# But Bob cannot comment
>>> bob_graph.put_comment('some_facebook_id', "test_comment")
*** GraphAPIError: (#100) Error finding the requested story

Interestingly, this only happens when Alice's wall post has an attachment. It does not happen if Alice makes a wall post with no attachment, just a message.

I'm totally confused as to how the permissions could be any different between wall posts with attachments and wall posts without them.

Anyone know what I'm doing wrong?

1
Looks like you are using test users, are all friends? Test users tend to give problems sometimes. Otherwise, can Bob pull Alice's posts via Bob's access token? Can Bob comment within Facebook UI on Alice's post?phwd
Actually Alice and Bob are real Facebook Users (me and a coworker). Bob can comment from within the Facebook API on Alice's post. When Bob tries to get Alice's feed with his access_token, he can only see the feed objects with no attachments.Clay Wardell

1 Answers

0
votes

This ended up only happening with Alice -- with other users Bob was able to comment on their wall posts. I'm chalking it up to Alice having weird Facebook privacy settings.