I have a facebook app, and I am able to share links, and image for this link, on FB, using FB.ui.
The point is, depending for the FB account who is sharing the link, I can get big image, or small one.
This is a real pain, because if I configure and send big image, on the accounts which uses small one, the image is cropped, and also on the other way.
I am sending, as far as I know, all known parameters for FB, but the result is the same.
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:title': title,
'og:description': description,
'og:url': invitationLink,
'og:image:url': imgPath,
'og:image:width': imgWidth,
'og:image:height': imgHeight,
'og:image:alt': 'refer a friend by lottoland'
}
})
});
What could be wrong here? How can I "force" facebook to always use same type of image?
Thanks anyone for the support.
Related
i am using below code to share fb feed
FB.ui({
method: 'feed',
link: 'https://developers.facebook.com/docs/',
caption: 'An example caption',
}, function(response){ console.log(response); });
response is always null i could not figure out why , i think when share done it must output some response
ref link : https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.5
Please guide if i am missing something
There is only a reliable callback if you authorized the user with the publish_actions permission. In that case, you will get the Post ID in the callback.
Else, there is no way to determine if a user shared something.
Keep in mind that you are not allowed to reward users in any way for sharing according to the platform policy: How to upload multiple images to one post in facebook via api
I want to post to user time-line with their current activity with photo uploaded by them.
For example:
I voted 'xyz movie'.
..image1.. ..image2.. ..image3..
Question : Mutiple photos possible? If yes, Is there limit of photos.I need to show 3-5 photos
Similar to Candy crush saga game post:
(just for reference,not exactly like this. For curiosity I wanted to know whether this is two posts?)
Which api can we use for this?
Is this possible with FB.ui feed api?
FB.ui(
{
method: 'feed',
to:'the Facebook ID of the person you wanna send',
name: 'Facebook Dialogs',
link: 'http://emplido.com',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
What you want is called rich stories, you can create them with open graph, here you can see what are the options available.
This is no easy deal, since you have a lot of options, so you really need to read the open graph docs to find which action fits best. In the docs you have a complete "how to", including how to post an action on a users wall with graph api https://developers.facebook.com/docs/opengraph/using-actions/
Remember that you have to two types of actions, common (docs here) and custom (docs here)
I know that documentation isn't the best answer or the one you wanted to, but in this case it's really necessary, as I said before, you have too many options, that allows you to create the best user experience for your app.
Quoting the docs here's a little example on how to create a story with open graph
To publish an action, make an HTTP POST to the following Graph API endpoint:
/{user-id}/{action-type}
This call should be signed with a user access token with
publish_actions permission or with an app access token for a user who was previously logged in.
For common actions, the {action-type} is the name of the action, such as og.likes:
/{user-id}/og.likes
For custom actions, it is a composite of the app namespace and the custom action type:
/{user-id}/{namespace}:{action-type-name}
The namespace is unique to your app, and is set in your app's dashboard on the Basic tab.
This example is the simplest one.
I was looking for and I am interested is there any way to get just shared facebook description using maybe fb.ui/fb.init or some other way?
EXAMPLE: IMAGE LINK
After the share I could get the description on my website let's say this way:
document.write('The description you've shared!')
So maybe one of you know how to do it or maybe someone knows how to figure it out. I am really looking forward for it! Thanks!
When you use the feed/share dialog using FB.ui, you can specify a callback function that receives the new post's post_id. Then using the post_id, you can retrieve the contents of the post by using an FB.api call. So a basic example:
FB.ui({
method: 'feed',
link: 'https://developers.facebook.com/docs/dialogs/',
caption: 'An example caption',
}, function(response){
FB.api(response.post_id, function(resp) {
document.write(resp.description);
});
}
);
I'm not sure if all the fields are right, but that should give you the basic idea. Let me know if this makes sense :)
Feed and Share Dialogs: https://developers.facebook.com/docs/reference/dialogs/feed/
Post Object: https://developers.facebook.com/docs/reference/api/post/
As of last night, facebook seems to be automatically popping up a captcha for any stream post from my application. This is for stream posts to my own wall as well as my friends wall. All of the stream posts link back to http://apps.facebook.com/fortyhumans with some addition params for analytics tracking. So I do not believe I am violating the requirement that links must point to the app canvas or website url.
I'm using the following code to do the post.
FB.ui(
{
method: 'stream.publish',
message: '',
attachment: {
name: sName,
caption: sCaption,
description: (sDescription),
href: sHrefLink,
media: [{'type':'image', 'src':sImgSrc, 'href':sHrefLink}]
},
action_links: [
{ text: sHrefTitle, href: sHrefLink }
],
user_prompt_message: sUserPrompt
},
Is there any way to avoid this captcha from popping up? Should I be posting using a different api? The user experience with captchas is very poor. Even posting to my own wall pops up a captcha.
I've read in previous posts here that some people changed to using a bit.ly url or something similar. But that would seem to violate the requirement that links in stream posts must point to canvas or website url.
Any help would be appreciated, or if this is not the right place then where should a question like this be posted.
I don't use Facebook, so at a bit of a loss here, as the API documentation doesn't quite answer this, perhaps someone here knows...
Looking at building a Facebook app to assist publishing from a content-driven web app. Obviously we need authorisation via OAuth to publish an app link to a facebook user's wall, but is authorization for everyone viewing the app within Facebook required? We have no interest in making use of the viewer's facebook data, we just want to show them a page.
If they have to authorise the app, then that's a bit of a barrier - but it's not clear if they can just view the app without anything getting in the way.
"is authorization for everyone viewing the app within Facebook required?"
If you mean having your app post a link to their wall, then yes, you will need to ask for their permission to do so. If you mean can other friends can see the post made by your app to an authorized user's feed? No the friends do not need to authorize your app to do that.
But remember Facebook now has the ability for you to specify which groups can see the post. See https://developers.facebook.com/docs/reference/api/user/#posts and read about the privacy field.
Yes, you can show app without any authentication. If you want user to share content then you can do it like this. Code is few months old, so I don't know if that works.
You cannot set custom text/message for the user. This will display popup window where user must confirm sharing/posting to wall.
<div id="fb-root"></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<script type="text/javascript">
FB.init({appId: 'APP_ID', status: true, cookie: true});
function share(object) {
var obj = {
method: 'feed',
link: 'http://apps.facebook.com/your_app_url/',
picture: object.picture,
name: object.name,
caption: object.caption,
description: object.description,
action_links: [
{ text: 'My Cool App', href: 'http://apps.facebook.com/your_app_url/' }
]
};
function callback(response) {
}
FB.ui(obj, callback);
}
</script>
If you're doing a canvas app, you don't need to. You get this generic information in the initial HTTP post:
user A JSON array containing the locale string, country string and the age object (containing the min and max numbers of the age range) for the current user.
algorithm A JSON string containing the mechanism used to sign the request.
issued_at A JSON number containing the Unix timestamp when the request was signed.
You get no actual information about the user, though. You need to authenticate to get that.