Why does facebook change the link in the FB.ui send dialog? - facebook

I'm creating a facebook dialog here that links to an external site (not from my domain). In the preview the link shows up correctly, but when the message is viewed in the inbox the url has been changed.
Specifically, I call this function:
var link = "http://someexternalsite.com/?id=xxx"
var desc = "a description"
FB.ui(
{
method: 'send',
name: 'title',
link: link,
picture: 'http://mysite.com/somepicture.jpg',
description: desc
},
function(response) {}
)
And the link changes (when viewed in your facebook inbox) to
http://facebook.com/someexternalsite
Is there some unwritten security policy somewhere? Do I need to get permission from someexternalsite.com to link to their site?

Facebook keeps control of the links that are posted. That way if a link is to a virus or a malicious site, Facebook just needs to change their URL.

It seems that facebook take the meta og: property.
I didn't find a way to get the link I wanted without changing the og:url.
Btw the picture is also erase by the og:image tag.

Related

How do i add a hashtag to to Facebook button share

How do i add a hashtag to to Facebook button share...
Please to understand it better click the image
enter image description here
Using the facebook sdk you can add the hashtag parameter to the object.
document.getElementById('share-facebook-btn').onclick = function() {
FB.ui({
method: 'share',
hashtag: '#thisisahashtag'
href: 'https://example.com',
}, function(response){});
}
https://developers.facebook.com/docs/sharing/reference/share-dialog
EDIT:
This answer is outdated, Facebook has since changed their policy (in this specific regard, suggesting a hashtag) - see Andrew's answer for details on the way to do this.
You simply don’t, because you are not allowed to.
See Platform Policy, 2.3:
“Don't prefill captions, comments, messages, or the user message parameter of posts with content a person didn’t create, even if the person can edit or remove the content before sharing.”
If the user wants the message to include a hashtag, then the user has to type it in by him-/herself.

Using the FB API, can you share a link, but serve an image that is not on the page

I can post a photo IF I had the time to get an app approved. I can share a link that pulls in a photo from THAT page. The goal is to post a link that goes to X, but the image is hosted somewhere else.
Is this possible?
Yes, it's possible by using the JavaScript SDK and the Share Dialog. For example, I can do the following, which shares a link but with a custom image, name and caption. It basically overwrites all the OG data on my page.
function fb_share() {
FB.ui( {
method: 'feed',
name: "Facebook API: Tracking Shares using the JavaScript SDK",
link: "https://www.webniraj.com/2013/05/11/facebook-api-tracking-shares-using-the-javascript-sdk/",
picture: "https://stackexchange.com/users/flair/557969.png",
caption: "Tracking Facebook Shares on your website or application is a useful way of seeing how popular your articles are with your readers. In order to tracking Shares, you must used the Facebook JavaScript SDK."
}, function( response ) {
// do nothing
} );
}
$(document).ready(function(){
$('button.share-btn').on( 'click', fb_share );
});
You can do the same thing in PHP if you have the publish_actions permission approved by Facebook. Both would produce the following result:
Source

How to change Facebook send dialog name and thumbnail?

so I implemented Facebook send dialog in my Facebook app, but the problem is that it always displays server name and some random thumbnail. I put everything as it shown in Facebook documentation but nothing works.
This is my code:
FB.ui({
method: 'send',
name: 'myName',
picture: 'image/path',
link: 'https://apps.facebook.com/APP_ID/',
});
You should read https://developers.facebook.com/docs/sharing/reference/send-dialog according to that page the parameters you can pass in are: app_id, redirect_uri, display, to, link. Neither name or picture are listed.

FB.UI Feed Dialog - cannot "share" a facebook's picture

Sharing facebook photo (really a facebook photo) using mobile web app & Feed Dialog.
The problem: Cannot send facebook's photo to the Feed Dialog.
All code works great. I get all properties as they sent to the function.
FB.ui
method: "feed"
link: 'url'
app_id: myAppID
name: 'photo's name'
description: ''
caption: $('#albumName').text()
picture: 'http://myUrl.com/logo.png'
, (response) ->
if response and response.post_id
console.log 'Photo was shared'
else
console.log 'Photo was not shared. Please try again'
If I place a static photo, to represent the Picture parameter, all goes fine, But if I try to call a facebook picture I try to share, then I get a 500 server error.
GET
https://www.facebook.com/dialog/feed?access_token=...662390597_s.jpg&sdk=joey
500 (OK)
This is totally bizarre. The URL that goes to the dialog iframe, goes with all the needed parameters, including access_token.
It seems like a design issue. Like someone in facebook don't want us to pretend to be facebook when we customly share things using their feed dialog, when we share facebook photos.
Am I right?
* Problem Solved. See my answer below *
!!! Problem Solved !!!
Facebook don't accept their own CDN as a source. We need to bypass that in order to share, therefore we can reshare a facebook the photo using a proxy.
http://images.weserv.nl does the job. Facebook accept the image as a picture param, and this way you are able to reshare their posts.
Usage example (plus width and hight to improve performance)
'https://images.weserv.nl/?url=' + facebookImageUrl + '&h=200&w=200'
I can't share facebook photo use this example
when i share with (fb.ui method feed) i get 404 error on this link
https://fbexternal-a.akamaihd.net/app_full_proxy.php?app=460125687444228&v=1&size=z&cksum=047536ba625482c9b5343f2eb94a7039&src=https%3A%2F%2Fimages.weserv.nl%2F%3Furl%3Dhttps%253A%252F%252Ffbcdn-sphotos-b-a.akamaihd.net%252Fhphotos-ak-ash4%252Ft1.0-9%252F10157304_1383818341898181_8685912667835736794_n.jpg%26h%3D200%26w%3D200"
"app=460125687444228
cksum=047536ba625482c9b5343f2eb94a7039
size=z
src=https://images.weserv.nl/?url=https%3A%2F%2Ffbcdn-sphotos-b-a.akamaihd.net%2Fhphotos-ak-ash4%2Ft1.0-9%2F10157304_1383818341898181_8685912667835736794_n.jpg&h=200&w=200
v=1"
Where my error ?

facebook meta tag description not updating

3 days ago I updated description within the meta tag of facebook, but change does not reflect when sharing link on facebook. Instead old description still appears. According to Facebook, it scrapes your page every 24 hours to ensure the description (and other share data) are up to date. However, one can manually refresh it by entering the post URL into the Facebook URL Linter
I did manually refresh it as well as now waited for 3 days. When i see debugging output from linter, it shows the correct up-to-date description, but old description still shown when sharing a link.
How to reproduce:
This is our website: https://www.tradeinsports.se/#tis1 (It's in swedish so bear with me please). If you go to above link and click on any of the two available products, and then share on facebook, you can see the difference in description from the one which appears in linter debugging output.
Any help would be appreciated.
Go to this page: https://developers.facebook.com/tools/debug/
Enter the url and click 'debug'.
Click 'fetch new scrape information'.
There's a lot of good data on that page that's helpful for the social media aspects of your site.
If you're implementing a Facebook Share or Facebook Like button, and your og: meta tags are being ignored, it's probably Facebook's overzealous cache.
The quickest way to clear Facebook's cache, and force Facebook to use the info from your og: meta tags, is to Lint the URL.
Enter the URL of the webpage that contains the og: meta tags in the Linter, and Facebook will clear its cache for that page. Your Share or Like button should then start pulling the correct info from your og: meta tags.
I was having this issue too. The scraper shows the right information, but the share url was still populated with old data.
The way I got around this was to use the feed method, instead of share, and then populate the data manually (which isn't exposed with the share method)
Something like this:
shareToFB = () => {
window.FB.ui({
method: 'feed',
link: `signup.mydomain.com/?referrer=${this.props.subscriber.sid}`,
name: 'THIS WILL OVERRIDE OG:TITLE TAG',
description: 'THIS WILL OVERRIDE OG:DESCRIPTION TAG',
caption: 'THIS WILL OVERRIDE THE OG:URL TAG'
});
};