Facebook API - How to post a website link with a custom image? - facebook

My goal is to post to my FB page (/{page-id}/feed) a link to a website, choosing the image to show instead of the picture scraped automatically from the web page. The image I'd like to show is not in the web page, so I cannot use the og:image tag.
I'm using the current API (v2.9) and this is what I've tried so far in the Graph API Explorer:
the picture parameter, that does not work as expected (it doesn't replace the automatic image)
picture and link parameters both pointing to the image url, with an action button, but it must have the same url used for the link parameter
the child_attachments parameter, but I need at least 2 images and the final result is quite different, too
additional fields of the link parameter, but thy were removed in the 2.9 API
a lot of combinations between these parameters, with no luck
What am I missing?

For information regarding why it isn't working. I assume they removed it to force users to add it to their website like Twitter did with their Twitter cards and maybe to stop impersonating pages.
https://developers.facebook.com/docs/sharing/reference/feed-dialog#deprecated-params

Related

Facebook share wrong image

We use the Facebook Share option on a website with newsarticles. The website is build with PHP and uses Smarty. We generate a unique URL (stripped like /news/headline-of-the-article) and have the meta properties defined.
When the owner shares a links with an image that was previously uploaded, everything is fine. When he uploads a news image, inserts it into the article and shares, Facebook takes another pictures, the pictures that it finds first on the source-code. Altho, in the preview-box just before you publish, it shows the correct image. Once placed, it's the wrong one.
The Facebook Debug Tool shows as og:image tag > og:image domain/UserFiles/images/news/standard_14.jpg
But when I look at the RAW tags og:image shows > domain/UserFiles/images/news/bosuil_1.jpg
So the og:image tag does it job and generates the correct URL, but facebook still posts the wrong image. When I force Facebook (manually) to scrape again, it shows everything good and also shares it correct.
I don't get it...
I had the same problem and found these best practices on facebook's developer wiki: https://developers.facebook.com/docs/sharing/best-practices#precaching
Use og:image:width and og:image:height Open Graph tags
Using these tags will specify the image dimensions to the crawler so that it can
render the image immediately without having to asynchronously download
and process it.
After specifying the width and height we have not had a problem with facebook crawling the right picture immediately.

Unity facebook SDK, can not post picture with FB.Feed

In my Unity IOS game, I am unsuccessfully trying to use FB.Feed to share a screenshot on the user's wall.
Facebook documentation uses FB.Api to publish the screenshot, but this method does not display a share dialog, it simply uploads the pic to Facebook.
Answers I have found so far:
Upload the picture using FB.Api, and then parse the FBResult for the picture URL, and feed that to FB.Feed Link to answer.
This method triggers an error, since it is not possible to use a Facebook URL as source for a picture.
Save the picture locally and prepend "File://" to the picture path. Link to question. This does not seem to work either, and the Facebook documentation does not seem to have any information on URL formatting.
My question:
Is this the correct (and only) way to display a share dialog when publishing a picture? Or am I looking in the wrong direction?
FB.Feed only allows you to post link to images. It doesn't upload the images to Facebook. Therefore, these images need to hosted somewhere on the net and not locally.
The best way to make it work is either upload the images to FB (with privacy property set to EVERYONE) using FB.API, and then share the link to that picture via FB.Feed. If you don't want to create duplicate stories, i.e. one from posting the picture and another from FB.Feed, make sure that you set no_story to true.

FaceBook feed dialog share options

Some Background Info
As of Mar/Feb 2014, the Facebook sharer.php way of sharing content no longer accepts custom parameters. See response from a Facebook engineer.
It used to allow multiple parameters in this form:
http://www.facebook.com/sharer.php?s=100
&p[url]={url}
&p[images][0]={img}
&p[title]={title}
&p[summary]={desc}
So you could override the title, image and description that facebook would scrape from the page, but it seems these are now ignored.
Instead, Facebook now favours the opengraph tags on the page.
So why is this a problem?
This is my scenario: I have a gallery page with multitple images. I have a lightbox that loads an image when clicked, and when the lightbox is shown, I also show share icons for all the major social networks, including facebook.
The facebook sharer url is built up using the above format, so I pass in the specific image together with the image caption. These values are now ignored.
Feed Dialog To The Rescue?
The Feed dialog method of sharing is now the preferred method, and it supports passing in custom images and captions. It works perfectly in my above gallery scenario. But it has a limitation: it does not allow you to share the content on a page you manage like the sharer.php does:
So my question is...
How can I get the Feed Dialog to work like the sharer.php and give the end-user the option to share to a group, friend's timeline or a page he/she manages?
But it has a limitation: it does not allow you to share the content on a page you manage like the sharer.php does
It incorrect statement. You can post anywhere using the Feed Dialog! You can use the to parameter and give it the concerned id where you want to share the feed.
For example
PS Facebook has introduces Graph API v2 today, and introduced new Share Dialogs over Feed Dialogs. I'm not share if that's to your significance but you can have a look.

Like Box ('Could not retrieve the specified page. Please verify correct href was passed in.')

I need some information, why like box frame not working: 'Could not retrieve the specified page. Please verify correct href was passed in.'. I`m testing this href in http://developers.facebook.com/tools/debug - it says correct answer, but frame not working.
In access logs for UA facebookexternalhit/1.1 always answer status 200 (and 301/302 for specific page).
example page: http://www.now.ru/item/series/comedy/Univer_222394
additional information: on some pages frame works, and some does not work
thanks.
The Facebook Like Box is really designed to use the URL for a Facebook page, not for a general Web Page. It pulls Timeline content from a fan page within Facebook.
It can be used for a Web Page if the page has defined Open Graph Meta Tags and has been Liked at least once. However, there will be no "stream" functionality. The Like-Box for a Web Page would just have functionality similar to the Facepile plugin (except that Facepile just shows you friends, and a Like-Box also shows non-friends.)
Typically, though, you would want to supply the Like-Box with a Facebook Page URL in the following format:
http://www.facebook.com/pages/Facebook-Page-Name/Facebook-Page-ID
Perhaps you are intending to use a Like Button or Facepile Social Plugin instead? Either of those can accept any URL as input.

Make Facebook _not_ automatically select a thumbnail from a page?

I'm using the Graph API to post to a user's wall via a 3rd party website. The update contains a link to said 3rd party website. (In functionality, it's kind of like just putting a Facebook "Like" button on the 3rd party page, except I want some more finely-tuned control over how the caption looks on Facebook.)
I am not specifying a picture for the post. When the post is created, Facebook's bot automatically connects to the 3rd party page specified in the link and selects an image to use as a thumbnail. Sadly, the image is almost never relavant, and I would just rather Facebook not look for a thumbnail at all.
I can probably put some Open Graph tags on the page to help out Facebook's bot, but I don't see a way to use Open Graph to specify that you'd like to have no image, and that Facebook shouldn't choose one automatically.
Any way to do this?
Although Facebook seems to ignore the picture set to an empty string in the Graph API call, setting an Open Graph tag for the picture which is an empty string seems to have done the trick.
When you publishing the the stream, include the "picture" property in the request and just set it to an empty string. This will ensure you dont have a url on the post. My other suggestion would be to put the Open Graph tags on the pages you are sharing. This will ensure that both you and others who share the url will have the correct data and images show on Facebook. http://developers.facebook.com/docs/opengraph