Posting to a Facebook Page as the Page (Not a Person)

Can a page post on another page's wall?

Yes, a page can post on another page's wall. If you have a Facebook page (which is NOT an application profile page) then you can click the arrow in the upper-right UI of Facebook and say "Use Facebook as a Page", select your page, and you will be "logged in" as that page. Pages can Like other pages, post on their walls, and comment, but they can't participate in apps or post to individual users.

Use that to test the scenario where one page posts to another.

Posting on facebook page - i am the only one who sees the post

Problem has been solved.

As an idiot, SandBox mode was activated (i didn't know that eveything done by the app was binded by the SandBox).

Posting photos to a Facebook page as a non-admin

You shouldn't need manage_pages permission. You want publish_stream.

manage_pages just allows you to obtain an access token to "log in as" an admin to a page the user has access to. Publish stream allows you to make comments and post on people's wall.

With publish_stream, you should be able to post pictures to the pages wall as long as that page's permissions allow you to do so. You won't be able to upload them to the pages album though, as that needs to be performed by an admin to the page. Just like your friends can post pictures to your wall, but they can't add photos to your albums.

Using the graph protocol, you can perform any action that both:

  1. The user you're authenticated as has permission to perform
  2. Your application has been granted permission to perform on the user's behalf.

So it's important to understand both the permission settings of both the actor (authenticated user) and the victim (the object being changed).

Posting to a Facebook Page Wall from a Web Server

In order to post to a Page as a Page, you have to use a Page Access Token. You get that with a User Access Token, and you can extend it so it will stay valid forever.

Steps:

  • Request a User Access Token with the manage_pages permission (valid for up to 2 hours)
  • Extend the User Access Token (valid for up to 60 days)
  • Get the Extended Page Access Token for your Page with the User Session
  • Store and User The Page Access Token in the publish call

It may sound a bit complicated, but there are many tutorials for this and you don´t actually need to program it, you can just use the Graph API Explorer.

Here are some Links about the Access Tokens:

  • https://developers.facebook.com/docs/facebook-login/access-tokens/
  • http://www.devils-heaven.com/facebook-access-tokens/ (see "Extended Page Access Token" for a step by step tutorial)

Is it possible for users to post to my Facebook page through my site?

There is no way to post on another user's wall (Facebook page) without being friends. If you are friends with that person you can use the FB.ui method:

FB.ui({
method: 'feed',
link: 'https://developers.facebook.com/docs/dialogs/',
caption: 'An example caption',
from: 'USER-ID',
to: 'FRIEND-ID'
}, function(response){});

For more information see Facebook Developer Docs

Posting on my Facebook page using Facebook graph api Not showing in public

Posts made with the API only show up if the App is public/live. It does not matter if it is for personal use only.

Facebook Post Link as Page Issue

I found the answer in another post.

    $pages = $this->facebook->api('me/accounts', 'GET');
$pages = json_decode(json_encode($pages), FALSE);

foreach ($pages->data as $page) {
if (in_array($page->id, $_POST['pages'])) {

$this->facebook->setAccessToken($page->access_token);

$data = array(
'access_token' => $page->access_token,
'name' => 'Facebook API: Posting As A Page',
'link' => 'https://www.webniraj.com/2012/08/09/facebook-api-posting-as-a-page/',
'caption' => 'The Facebook API lets you post to Pages you own automatically - either as real-time updates or in the case that you want to schedule posts.',
'message' => 'Check out my new blog post!'
);

$queryString = http_build_query($data);

$this->facebook->api("$page->id/feed?".$queryString, 'POST');
}
}

The key was to set the page access token via the Facebook SDK. This may be because I use the library elsewhere to set the access token as the user's; I guess the library must override the token sent in as a parameter.

$this->facebook->setAccessToken($page->access_token);

Reference: Posting to a Facebook Page as the Page (not a person)


EDIT: Another issue I just discovered is that I was building the query string myself and appending it to the API endpoint, like so:

$this->facebook->api("$page->id/feed?".$queryString, 'POST');

What you are supposed to do is send the $data array in as the third parameter of the API call:

$this->facebook->api("$page->id/feed", 'POST', $data);

The PHP SDK looks for an 'access_token' parameter in the $data, and because I wasn't sending in that array it wasn't finding it (and thus defaulted to using my user access token I had set previously).

After sending the data in as the third parameter of the API call I was able to remove the line:

$this->facebook->setAccessToken($page->access_token);


Related Topics



Leave a reply



Submit