Monday, July 19, 2010

Facebook Fans Page extended permission - Graph API

To grant Facebook Extended Permission by the application to the Fans Page.
Steps:

1.  Login as administrator account which the Fans Page under. After that, go to the apps' "Apps Profile Page". when you are in that "Apps Profile Page", click at "Add to My Page". From the popup screen, you can select which page you would like to add the application to.

2.  Modify the link below:  

    * notes: you can only request per extended permission each time, else you will getting error page.
    manage_pages - to publish stream to your fans page wall
    insights - this is rather useful, if you are trying to get "access_token" of the page, hence to post a stream to the fans page

3. To get the access_token of the fans page, please run the link as below:

    -  access_token : 
       this access_token can be the temporary access token you can get from graph.facebook.com, or it's the access_token you gain after you grant extended permission to the                 
       facebook application.

or The lastest way


https://developers.facebook.com/tools/explorer//?method=GET&path=

click on "Get Access Token"



To post stream to Facebook Fans Page:

Example PHP code:

$facebook = new Facebook($api_key, $secret);
$attachment = array (
'access_token' => $defaultPageAccessToken,
'message' => "some useful message",
'name' => $applicationName,
'caption' => $applicationDefaultCaption,
'link' => $applicationUrl,
'description' => $applicationDefaultDescription,
'actions' => null
);

try {
$result = $facebook->api('/'.$defaultPageId.'/feed/', 'post', $attachment);
} catch(Exception $e) {
echo '<pre>';
print_r($e);
echo '</pre>';
}












Best Regards,
jack

No comments:

Post a Comment