3
votes

I have a issue with the facebook API. I created a fan page and set admin of page which is my account facebook. After that, I want to use Facebook API to post a feed to fan page. In this case, I have tested with 2 types : status message and share link.

1>Post a message to fanpage :


    $publishStream = $fb->api("/" . $fbPageId ."/feed", 'post', 
    array(
        'message' => 'test ' . time() . ' http://example.com',
        )
    );

Result : I've posted to fanpage success and owner of feed was fanpage.

2> Share a link to fanpage


    $publishStream = $fb->api("/" . $fbPageId ."/feed", 'post', 
    array(
        'link' => 'http://example.com',
        )
    );

Result : I've posted link to fanpage success and owner of feed was user. This feed will show in Recent Posts by Others on ABC Page (ABC is name of fanpage). Anyone have got same issue like me ? Thanks.

4

4 Answers

1
votes

Replace feed with links

$publishStream = $fb->api("/" . $fbPageId ."/feed", 'post', (...)

to

$publishStream = $fb->api("/" . $fbPageId ."/links", 'post', (...)
0
votes

What kind of access token did you use each time? Looks like you used a page access token the first time, and an user access token the second.

0
votes

I just confirmed this behavior, it's really unexpected. When using a user token and posting with only the message attribute set it posts as the page.

The "Always comment and post on your page as Page.." box is unchecked in the admin settings, which is even weirder. They must be using different back ends for posting messages, as they don't have to scrape outside url links for og tags.

Anyway, use page access_tokens from the graph.facebook.com/USER_ID/accounts endpoint for consistent behavior.

0
votes

I am having the same issue. And I am using Page access tokens each time. If the post has a "message" it goes in on the Page (and thus shared with those who like the page). If it only has a "link" it goes to my personal news feed and is shared only with friends.

And by the way, I tried including both "message" and "link" and it went on my personal new feed, not the page.