How to attach several photos to a wall post? - facebook

If you go to this app's wall: http://www.facebook.com/mindjolt they somehow attach several photos to each wall post. Is there a way to do this programatically?
Looks like they are posting to the wall manually, but I can't even figure out how to do this through facebook interface.
Any ideas?

You have two options that I'm aware of:
You can use the Facebook Graph API to post to someone's wall. You can attach a picture (I'm pretty sure it's only one), link, video, etc. to the post: http://developers.facebook.com/docs/reference/api/post
Alternatively, you can use the stream.publish method from the old REST API http://developers.facebook.com/docs/reference/rest/stream.publish and set the attachment.media parameter http://developers.facebook.com/docs/guides/attachments to post more than one image in one wall post.

I there no way to do it with the new Javascript API (SDK)?
The old way was:
var media = [];
media[0] = {'type':'image','src':'xxx','href':'yyy'};
media[1] = {'type':'image','src':'xxx','href':'yyy'};
media[2] = {'type':'image','src':'xxx','href':'yyy'};
media[3] = {'type':'image','src':'xxx','href':'yyy'};
media[4] = {'type':'image','src':'xxx','href':'yyy'};
attachment = {
'href':'xxx',
'name':'xxx',
'caption': '',
'media': media
};
FB.Connect.streamPublish('', attachment, '');
but the new way?
FB.ui(
{
method: 'feed',
name: attachment.name,
link: attachment.href,
caption: attachment.caption,
picture: 'xxx',
}
,
function(response)
{
alert('callback');
}
);
there is no key for attachment or for media, only picture??
edit: Ok, I got it, there is the old way, the new way, and there is the old way via the new way:
FB.ui(
{
method: 'stream.publish',
attachment: attachment,
action_links: action_link
}
,
function(response)
{
//alert('callback');
}
);

Related

How to post images (as photos) to Facebook using FB.ui feed?

When I post images using FB.ui feed it works fine but the images are links son when you click on them you cannot see a bigger version of the image.
I read that you can use:
FB.api('/me/photos?access_token=’…
But I need the dialog so the user can see the photo and add a message in FB “environment or context”.
This should be simple, no?
This is my current code:
var obj = {
method: 'feed',
link: url_base,
picture: up_img_final_url,
name: FBname,
caption: FBcap,
description: FBdesc,
};
FB.ui(obj, function(response){
if(response)console.log('Post');
else console.log('Cancel');
});

Fb.ui method feed not working. Loading gif appears but no error message or anything

So I've been trying to implement a Fb method feed so that people can share songs from my website. But it doesn't work.
It pops up a loading gif in the dialogue and thats it. No error nothing. I've wasted a lot of time trying to figure this out but haven't been able to.
Here's the code,
share_obj = { method: 'feed',
link: "", redirect_uri: "",
picture: ",
name: "",
caption:"" ,
description: ""
}; FB.ui({method: "permissions.request", "perms": 'publish_stream'},
callBack);
function callBack(response) { if(response["perms"]=="publish_stream") { var obj = share_obj; FB.ui(obj,callback_share); } } function callback_share(response) { }
Does it have something to do with Facebook app migrations or app permissions?
So turns out, there s no need to ask for user permissions when invoking the Fb.ui method.
Permissions are only required when you intend to publish stories via the graph API.

Facebook Post Publishing without any Dialogue using Javascript SDK

I have been searching for facebook publishing without showing Dialogue.
While reading Facebook developers doc, there are several things which seems to answer the question but after using them, I concluded those are not for this functionality.
Display Modes: They are different type of display mode for dialogues, but there is no way to define if I don't want to show the dialogue.
Explicit Sharing: This seems to be most close. But there is no way to use it in JS SDK. And the parameter mentioned there, I tried in JS but no resolution.
Then here what came to be most successful for me, to use
methode: '/me/feed'
But the problem is, it says:
[User] shared a link
Which I don't want. I want a normal publishing, but without any dialogue to be displayed.
Code I am using for simple publishing is below:
function publishNewsFeed(picURL, name, caption, description)
{
var obj =
{
method: 'feed',
link: fbAppURL,
picture: picURL,
name: name,
caption: caption,
description: description
};
function callback(response)
{
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
Any help will be appreciated.
Thanks
-WI
Display Modes: They are different type of display mode for dialogues, but there is no way to define if I don't want to show the dialogue.
That would be nonsense – if you don’t want to use a dialog, then don’t use a dialog.
But if you want to use a dialog, then it has to be “shown” in some way – otherwise it would not be a dialog.
But the problem is, it says [User] shared a link Which I don't want.
That is current “bug” – if you supply action links with your post, it will show up normal.
https://developers.facebook.com/bugs/485696594791863
Try this:
function jesseSays(){
var body = 'Yeah science Mr. White!!';
FB.api('/me/feed', 'post', {
message: body,
link: 'http://www.neoapps.com.br',
picture: 'http://www.neoapps.com.br/assets/img/logo-big.png'
}, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
}

check if user share on facebook application

is it possible in an iframe applications check if the user share something successfully. may i get the request id if it is successfully shared so if it is shared i want to make the share button's visible false to that user and the user earns some points if the share is successfull
so is it possible to know and check it?
i am using c# but it is ok for javascript code
thanks
using the Javascript SDK you should be able to get that information.
FB.ui({
method: 'apprequests',
message: 'Your message here',
title: 'App Request',
},
function (response) {
if (response) {
var numberSelected = response.to.length;
var firstIdSelected = response.to[0];
} else {
alert('canceled');
}
});

Facebook Request 2.0

I am kind of confused on how to use the new facebook request dialog box. Using the below mentioned function opens a box and I am able to send the request to the user who receives it. But when the user clicks on the request nothing happens instead the user is redirected to an internal link:
http://www.facebook.com/?request_ids=105890902828361%2C105893002828151%2C105899456160839%2C105902046160580%2C105904092827042&notif_t=app_request
How to resolve the issue? (Canvas Page not defined in Settings but Canvas Url is)
function requestsDialog()
{
FB.ui({
method: 'apprequests',
message: 'Here is a new Requests dialog...',
title: 'example',
data: 'trackinginfo'
},
function(response) {
if (response) {
alert('Request was sent.');
} else {
alert('Request was not sent.');
}
}
);
};
You need to specify a Canvas Page. For example, if your canvas page is:
http://apps.facebook.com/test_application
Then the URL that user will go to when clicking on the request will be:
http://apps.facebook.com/test_application?request_ids=12020393994,129193929392
At which point you can use the Graph API to look up what the requests are using the id (documentation here)