Publishing on facebook friends wall privately using api graphics

I wanted to publish the feed on the friends wall from my application and set it as private, available for logging in to the system of the user and friend. I want to do this using the new api diagram, I saw that if I set the "to" parameter in the feed message, it would be published on the user's friends wall.

I found the code here: http://forum.developers.facebook.net/viewtopic.php?id=56458 (Submitted by VovaOnline) (the link is dead, as facebook removed the forum)

$result = $facebook->api('/me/feed', 'POST', array( 'from' => array( 'name' => 'Vladimir Ageenko', 'id' => '100001308281502' ), 'name' => 'TEST NAME', 'caption' => 'Test Caption', 'description' => 'Test Description', 'message' => 'This is test.', 'privacy' => array( 'description' => 'Vladimir Sergeevich', 'value' => 'CUSTOM', 'friends' => 'SOME_FRIENDS', 'allow' => '100001338940933' ) )); 

I set the message type as a "link". Can someone tell me what is wrong with this code. One thing that I know is that the "from" field must be "to" and it must be passed in the "data" variable. I am not sure how to do this. Can anyone help me?

+4
source share
3 answers

I do not think Facebook allows you to do this at this time. See the graphical API documents in the wiring:

http://developers.facebook.com/docs/reference/api/post/

privacy statement:

"Note: This privacy setting applies only to messages of the current or user-specified own wall. Facebook ignores this setting for targeted messages on the wall (when the user writes on the wall a friend, page, event, group connected to the user). In accordance with the behavior on Facebook can see all targeted messages by anyone who can see the target wall.

I interpret this as meaning that if you post another user (channel) on the wall, privacy is uncontrollable.

+1
source

You should encode the privacy array, try the following:

 $privacy = array( 'description' => 'Vladimir Sergeevich', 'value' => 'CUSTOM', 'friends' => 'SOME_FRIENDS', 'allow' => '100001338940933' ); $result = $facebook->api('/me/feed', 'POST', array( 'from' => array( 'name' => 'Vladimir Ageenko', 'id' => '100001308281502' ), 'name' => 'TEST NAME', 'caption' => 'Test Caption', 'description' => 'Test Description', 'message' => 'This is test.', 'privacy' => json_encode($privacy) )); 
+5
source

From now on, it is not possible to post a friend on the wall because of a violation on February 6, 2013:

https://developers.facebook.com/roadmap/completed-changes/

Removing the ability to publish to friends through the Graph API. We will remove the ability to publish to the walls of the user's friends through the API chart. In particular, messages against [user_id] / feed, where [user_id] is different from the session user, or stream.publish calls, where the target_id user is different from the session user, does not work. if you want people to send messages to the schedule of their friends, call. Stories that include friends through the user, tagging or action tags will be displayed on the friends timeline (assuming the friend approves the tag). See this blog post for more information.

+1
source

Source: https://habr.com/ru/post/1332605/


All Articles