Facebook custom story layout - facebook

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.

Related

Adding Place to Facebook Feed Dialog

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

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?
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.
This problem troubled me for so long. Everything seemed setup correctly but as soon as I added a link, it would post as Admin instead of Page. The answer above by triangle_man solved my problem. When using the PHP sdk, the specific line of code I needed was:
$page_token = $facebook->api("/$page_id?fields=access_token");

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.

How to upload custom app image (tab_image) for Timeline Page tabs via API?

Facebook released the new Timeline for Pages today. Apps installed to pages as "tabs" now appear above the timeline with a 111px x 74px size thumbnail "app image". You can customize this on a per-page level (just like the custom tab name) if you navigate the Facebook Page admin interface.
You can update the tab's "custom name" via the Open Graph API, but they do not appear to have updated their API docs to show how to upload a custom tab_image (assuming they will). Is it possible now but undocumented? Has anyone figured out how to do this yet?
Updated 2016:
With the latest Open Graph 2.5 API tabs endpoint and PHP SDK 5, the code should look like this:
<?php
$fb = new Facebook\Facebook([/* . . . */]);
$response = $fb->post(
'/{page-id}/tabs',
[
'custom_name'=>'My Custom Tab',
'custom_image_url'=>'http://publicly.accessible/image.jpg',
'app_id'=>'{app-id}',
],
'{page-access-token}',
);
Original 2012 post:
I figured it out, it's just like uploading an image. The field is called "custom_image". Presumably they will update the documentation soon. It's nice they enabled this API hook so quickly with the new release!
Here's how to do it with the Facebook PHP SDK:
<?php
$page_access_token = 'XXXXXXX'; // you'll need the manage_pages permission to get this
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
'fileUpload' => true, // enables CURL # file uploads
));
$facebook->api(
'/PAGE_ID/tabs/TAB_NAME', // looks like "app_xxxx" where xxxx = APP_ID
'POST' // post to update
array(
'custom_image' => '#' . realpath('path/to/my/file.jpg'),
'custom_name' => 'My App', // give it a custom name if you want too
'access_token' => $page_access_token // access token for the page
)
);
Cheers
As you said Timeline for Pages is just announced and it's too soon to say it'll be possible via API. Currently it's not possible even in settings of your App in Developer Application.
This information is simply not yet documented in help center or Graph API documentation.
It's also way soon to say someone have discovered if such functionality exists...
We all should wait a bit and probably file bugs which may get some response from officials confirming, rejecting or adding this to wish list.

Is it possible to edit a post title on user facebook profile using facebook graph api?

I have done a facebook application which upload photos into default application album. I found that after the upload, there will be a post displayed on user profile saying 'Smi added 10 new photos to the album xxxxx.'. Is it possible to edit the message above to 'Smi added 1 new photo to the album via xxxapplication'? I am using Graph api to upload the photo. The code I am using to upload is
$file = "#".realpath($image);
$args = array(
'message' => '',
"access_token" => $access_token,
"image" => $file
);
$data = $facebook->api('/me/photos', 'post', $args);
No you have no control over the activity feed message for items like that. The only items you will be able to control when uploading are photo captions, album titles, and tagged users.