Search code examples
facebookfacebook-graph-apisdkfacebook-php-sdkfacebook-wall

Facebook timeline wallpost doesn't work as aspected


Im using the Facebook SDK Api [PHP] to post automaticly on a timeline wall.

I created a App and requested the access_token with the following permissions: manage_pages,publish_stream,offline_access.

Im using now the access_token to post the message on a page (/PAGEID/feed) where im moderator.

The following is going OKAY and get the post working under the name of the Facebook page:

$attachment = array(
    'access_token'      => $accessToken,
    'message'           => $description,
);

$res = $facebook->api('/PAGEID/feed', 'POST', $attachment);

When Im adding some link + name AND/OR picture it will post not as wall post but as "recent message of others" with as name my own user:

$attachment = array(
    'access_token'      => $accessToken,
    'message'           => $description,
    'link'              => 'http://www.google.nl',
    'name'              => $description,
    'picture'           => $image,
);

How can I post full messages with link and picture on the wall self?


Solution

  • If I understand you correctly, you are trying to post as the Page but it's showing up as a post by you. Is that correct?

    If so, I think you need to post using the Page's access token, rather than your own access token. Look at the section called "Page Access Tokens" on https://developers.facebook.com/docs/reference/api/page/. Once you get the page's access token using the technique described there, you can set it to be the token that PHP SDK uses by doing $facebook->setAccessToken(.... access token value ...). Then you can do the post and it should show up as having been created by the page.