Using 'from' to post a facebook message as App name
I have an Facebook App that is currently posting to a WALL. All the posting are being Titled as MY post. I would like it to be titled by the App. In this documentation, it says there is a 'from' parameter. I've tried to use it a couple of ways and both ways have been unsuccessful. Does anyone have a clue?
https://developers.facebook.com/docs/reference/dialogs/feed/
$attachment = array('message' => $message,
'from' => "<APP_ID>",
//'from' => array('name' => "Sen开发者_如何学运维der's Name",'id' => "<APP_ID>"),
}
$me = $this->facebook->api('/me/feed/', 'POST', $attachment);
The from property MUST be a user or a page. You could possibly create a Facebook page with the name of your application and use that.
I've never used the FROM parameter in the Graph API, just on the legacy REST API. And that API parameter was actually actor_id instead of FROM.
Obviously this doesn't solve your problem. To solve your problem, get the access_token
for your page from the /me/accounts
Graph API end point. When you use this access token, you are identified as the account for which it corresponds, and when you post to /{page_id}/feed
with it, it will be posted as the page and in turn be published out to all your users.
<script type="text/javascript">
FB.api("/123123123/feed", "post", {
message: "Test!",
access_token: '184484190795|SDlfkjweifljasdf.3600.123123123.1-2342342|234234234234|XLjsldfjLISJflwieab'
},
function(response)
{
console.log(response);
});
</script>
Thank you all for the suggestions. I finally was able to solve the problem by combining these 2 articles. The basic steps of the first article is still valid. But it is written in the old API. The second article help be get through the step the new REST api couldn't do. Hope this helps.
http://www.emcro.com/blog/2009/01/facebook-infinite-session-keys-no-more/ http://www.alyssapowell.com/2010/10/how-to-generate-an-infinite-session-key-in-facebook/
精彩评论