We're trying to construct an application that can - at the request of logged-in users with the appropriate blessings within the app - send out a message to any or all of the user's FB friends declaring that they have been sent a gift.
We have been able to get this to work for sending just a small few friends this message, as a wall post (notifications and messages are unavailable in the API). However, with any number of friends larger than ~15, the majority of the users return an OAuthException: (#200) The user hasn't authorized the application to perform this action
.
These same users can be sent the message individually or in a small group. However, we expect to have this feature used by users with hundreds or even thousands of friends.
The API docs have not been forthcoming, especially since they are stuck halfway between the old and new Graph interfaces. We are currently using the following code (in precis) to make the API requests, in PHP, in the presence of a current Facebook session with the credentials of our user:
$wall_info = $customer->getCustomWallData();
$attachment = array(
'message' => $wall_info['msg'],
'name' => $wall_info['link_title'],
'caption' => $wall_info['link_caption'],
'link' => $CUZ->index,
'description' => '',
'picture' => $CUZ->http . '/uploads/promo_logo/' . $wall_info['filename'],
'actions' => array(
array('name' => 'Get Search', 'link' => 'http://www.google.com')
)
);
foreach($friendStack as $friend_data) {
$friend_fb_id = $friend_data['fb_id'];
$result = $facebook->api("/$friend_fb_id/feed/",'post',$attachment);
}
Does anyone here know:
- Why this is happening
- Whether there is any way to get around it to post to all the users
- If so, what this would be?
Thank you.