FB.ui feed post dialog changes - facebook

When a user posts a comment on one of our sites, we give them the option to send the comment to their facebook wall. i.e. the following code:
FB.ui({
method: "stream.publish",
attachment: {
"name": "article title",
"href": document.location.href,
"description": "an excerpt from the article"
}
message: userComment, // The comment that the user entered on our site
user_prompt_message: shareText // "What do you think?" or similar, configurable
}, function(response){
if(response && response.post_id){
// success!
}
else{
// failed!
}
});
This popped up a dialog with the "your comment here" input pre-filled with the same comment the user posted on our site. Was totally fine via the Facebook Platform Policies, even officially encouraged at the time we initially put it into place.
But evidently they deprecated the message parameter on July 12th. So now you get a big "share" box and the content you actually want to share (the user's comment) isn't included anywhere. So, we're looking for another way to post the user's comment.
So, the latest documentation on stream.publish still says we can pass the message parameter directly via the API call, i.e.
https://api.facebook.com/method/stream.publish?callback=derp&message=EABOD+Facebook&access_token=MY_ACCESS_TOKEN&format=json
I tested it and it works, but I'm wondering if it will still work going forward, or if they just haven't shut it down yet?

If it'll replaced, i will be the feed method, which is very similar to streem method.
FB.ui(
{
method: 'feed',
link: 'http://myapp.com/myitem',
display: 'iframe',
picture: 'http://myapp.com/mylogo.jpg',
message: 'my message',
name: 'click to see item',
caption: 'title'
})
we will see next major version and see!

Related

Facebook Feed Dialog - Post without a link

I am trying to use the Facebook Feed Dialog to post a plain text message. According to the docs this should be possible by simply leaving the 'link' parameter empty'
https://developers.facebook.com/docs/sharing/reference/feed-dialog
"The link attached to this post. With the Feed Dialog, people can also share plain text status updates with no content from your app; just leave the link parameter empty."
When doing this I successfully see the share dialog, but when I enter a message and click post I am receiving the following error:
Action Requires At Least One Reference: The action you're trying to publish
is invalid because it does not specify any reference objects. At least one
of the following properties must be specified: object.
This is my code, if add a link, it works as expected.
FB.init({appId: APP_ID, status: true, cookie: true});
FB.ui({
method: 'feed',
title: "",
link: "",
caption: "",
description: "",
image: ""
}, function(response){});
Does anyone know how to successfully post a plain text message from the feed dialog?

Appcelerator Titanium Facebook module share dialog not showing

I am trying the example code for a share dialog using the facebook module:
The vars for link, name, description, caption and picture has all been set to appropriate strings beforehand.
if(Alloy.Globals.Facebook.getCanPresentShareDialog()) {
Alloy.Globals.Facebook.presentShareDialog({
link: link,
name: name,
description: description,
caption: caption,
picture: picture
});
}
else {
Alloy.Globals.Facebook.presentWebShareDialog({
link: link,
name: name,
description: description,
caption: caption,
picture: picture
});
}
When this code is executed nothing happens.
I also added a share listener to see if any events are sent, but it is silent...
var fbShareListener = function(e){
if (e.success) {
alert(L("FB_SHARE_SUCCESS"));
Ti.API.info('Share request succeeded.');
}
else {
alert(L("FB_SHARE_FAIL"));
Ti.API.info('Failed to share.');
}
};
Alloy.Globals.Facebook.addEventListener('shareCompleted',fbShareListener);
The Facebook module seems to work otherwise, we are using it to login and linking external accounts to Arrowdb.
UPDATE:
It seems that it will give false for getCanPresentShareDialog() so it will try to run the presentWebShareDialog(). But when i look in the API docs for the facebook module this particular method documentation says: "This method has been REMOVED since 5.0.0".
The getCanPresentShareDialog also states "This method has been REMOVED since 5.0.0" in the documentation.
Anyone have any clue what to do instead?
Now they changed the docs so that it is simply to call:
presentShareDialog()
And it will handle everything on its own.

The posts fo Feed method in FB.ui are not visible in Facebook timeline

I created an Application in facebook and used in my website.
In my page I am using this function to share a photo.
function postToFacebook(url, img) {
FB.ui({
method: 'feed',
link: url,
picture: img,
name: "Sample name",
description: 'sample desc'
}, function (response) {
console.log(response);
});
}
This function is working and sending a ShareLink on my Time line. But nobody can see my post. I just can see the post on my TimeLine !!!
What it is the problem?
I found out the problem myself.
it is because of the Status of Facebook Application.
Do this setting to fix the problem:
Go to Facebook Developer => You Application => Status & Review => set this option to YES:
"Do you want to make this app and all its live features available to the general public?"

captcha on stream 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.

Post a comment on a page/link true FB.api

Is there a method for posting comments on pages with Facebooks js api? FB.api().
You can post on a persons wall with
FB.api('/me/feed', 'post', { caption: message, name: "the tile", description: "a neat message", link : "http://www.stackoverflow.com" }, function(response) {});
But is there an equivalent of posting a comment to a page? Without the social-plugin "comments box". Anyone?
All of the graph api is built on urls, all of the different SDKs (including the js one) just wrap up the http requests for you.
As the documentation for page states:
feed
This connection corresponds to the Page's Wall. You can create a link,
post or status message by issuing an HTTP POST request to the
PAGE_ID/feed connection. To see more details please see links, posts,
and status messages documentation.
To impersonate the Page when posting to the wall (i.e. post as the
Page, and not the current user), you must use a Page access_token with
the manage_pages and publish_stream permissions, as described under
Page Access Tokens above.
To do that from the javascript sdk then is something like this:
FB.api('/PAGE_ID/feed', 'post', { caption: message, name: "the tile", description: "a neat message", link : "http://www.stackoverflow.com" }, function(response) {});
yes you can, but you must be administrator of the page and you must request the access token with the correct authorization: publish_stream, offline_access, manage_pages, read_stream
there is a great tutorial here to get your access_token and to post message: http://sp4ce.net/computer/2012/02/15/facebook-page%3A-automatic-answer.html
Here is official Facebook page for that:
http://developers.facebook.com/docs/reference/api/page/
Seems that it is not possible, and will never be:
This functionality was never and is not intended to be available.
An error message has been added for this case: "Comments may not be
added to a comment plugin"
https://developers.facebook.com/bugs/164794086987157