Adding Place to Facebook Feed Dialog - facebook

When posting to /me/feed, it's possible to add a page id of location with "place". This results in a post as a check in that shows the message with a map of the location.
Adding "place" as a query string parameter to the feed form at facebook.com/dialog/feed doesn't seem to add the location to the post. Is there a way to use /dialog/feed and add a location?

Please, provide your code.
This is my code, and it's working:
$post_url = '/' . $user . '/feed';
$msg_body = array(
'message' => 'message for user timeline',
'place' => '106339232734991',
);
// posting on user page feed
$postResult = $facebook->api($post_url, 'post', $msg_body );

After discussing on FB group, it looks like only message, picture, and place work to make a checkin with a location. If adding other parameters like caption or link, it turns into a regular feed post without a location. This is unfortunate because without a link back to the app, there is almost no incentive to make a checkin from an app.

https://developers.facebook.com/bugs/428651263853608 - “javascript ui feed dialog - place parameter does not work”
Response from Facebook:
'place' is not a supported parameter per https://developers.facebook.com/docs/reference/dialogs/feed/.
Status changed to By Design

Related

FB Api: Tag/mention another page on my own fan page

I have a fan page which I am an admin of. I'd like to create a simple button - when I click it, it would create a post on my Fanpage, with a predefined a message and a photo. I have been able to achieve this fairly simple using the Graph API:
$args = array(
'access_token' => <my_acc_token>,
'url' => <url_of_image>,
'message' => <my_message>
);
try{
$facebook->api('/<id_of_my_page>/photos', 'POST', $args);
}catch(Exception $o ){
print_r($o);
}
ISSUE:
I would like to now be able to also Tag or Mention another page in that post, but nothing seems to work!
I tried adding a #[user-id-of-page] into the message property or my $args array - but to no avail.
Is tagging/mentioning even possible without having to use Facebook actions? How can this be achieved?
https://developers.facebook.com/docs/opengraph/using-actions#pages
Be aware that you have to go through the review process with this, else you can only mention your own Pages.
So in order to mention other Pages, you would need to get the permissions manage_pages and publish_actions approved, and you need to get the "Page Mentions" feature approved. Go to "Status & Review" in your App settings and click on "Start a Submission". Scroll down in the list on the left and you will find "Page Mentions".

Facebook custom story layout

Does anyone know which attribute on the facebook open graph custom story controls the section highlighted in this picture?
https://docs.google.com/file/d/0BxYOAz86zlLvSEN5bFlUUWV6bm8/edit
I looked at the docs:
https://developers.facebook.com/docs/opengraph/creating-custom-stories/
and it mentions editing the attachment but I can't find the property that would be responsible for that specific highlighted content
thanks for your time.
it the message attribute of the story.
for example in the php sdk:
$response = $facebook->api(
'me/namespace:action',
'POST',
array(
'object' => id of object or json with all object params,
'message' => here is the message
)
);
be carefull though, facebook will not validate your app if it is not the final client (facebook user) that ads the text there. you cannot pre fill it no more.

How do I force the Facebook Like Button to re-scrape my page?

I created a like button on a page (http://www.usna.edu/BillAF/game.php) that sends the URL/data for it's parent page. Unfortunately, when I first put it in, an older version of the page was at the location of the parent page that did not have the open graph meta-tags on it.
So when someone "likes" the page, it sends the wrong title and a "garbage" image of half of the letter "e" on a white and gray square.
I checked: http://developers.facebook.com/tools/debug and it has the updated info. I also tried changing the associated AP ID to a new one, and neither seems to have refreshed what it sends when I "like" it. I also tried adding index.php to the end of the URL it is supposed to be posting (http://www.usna.edu/BillAF) but to no avail.
Is there anything I can do to force it to re-scrape the page? If not, does anyone know how long it will take for facebook to re-scrape it on their own?
A good way to clear the facebook cached image and text is by running the tool Debugger:
http://developers.facebook.com/tools/debug
By putting the url that you are sharing there, it will refresh facebook cache from your website.
Facebook has an API for re-scraping page data, I use the following function:
function purgeFacebookCache($url, $debug=false) {
// Set the variables for Facebook
$fields = array(
'id' => urlencode($url),
'scrape' => true
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
// Connect
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://graph.facebook.com');
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$result = curl_exec($ch);
// Debug
if ($debug) {
var_dump($result);
}
}

How to star a post on a facebook fanpage using graph api?

I'm posting on my fanpage but i want to do highlight posts. Any suggestions?
I have to star them one by one on the fanpage. Is there any way to do this? I also read the documentation but there is no examples.
http://developers.facebook.com/docs/reference/api/page/#posts
Sample of code:
$args = array(
'access_token' => $page_info['access_token'],
'message' => 'MY MESSAGE'
);
$post_id = $facebook->api("/MY PAGE ID/feed","post",$args);
Im using PHP SDK 3.1.x.
Use:
POST /<post_id>/ with param timeline_visibility = starred
timeline_visibility must be one of the following values: hidden, normal, starred.
Also see https://stackoverflow.com/a/19861323/1784062.

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' => "Sender'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/