How do you autopublish with FB.UI?
facebook, facebook-graph-api, javascript
Solution
http://www.takwing.idv.hk/tech/fb_dev/jssdk/learning_jssdk_12.html
The following will autopublish if you have the permissions unlike FB.UI :)
function publishPost(session) {
var publish = {
method: 'stream.publish',
message: 'is learning how to develop Facebook apps.',
picture : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif',
link : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/',
name: 'This is my demo Facebook application (JS SDK)!',
caption: 'Caption of the Post',
description: 'It is fun to write Facebook App!',
actions : { name : 'Start Learning', link : 'http://www.takwing.idv.hk/tech/fb_dev/index.php'}
};
FB.api('/me/feed', 'POST', publish, function(response) {
document.getElementById('confirmMsg').innerHTML =
'A post had just been published into the stream on your wall.';
});
};
Problem
I have the stream_publish permission but it still pops up a dialog and there doesn't seem to be any way to pass in an autopublish bool (like it was before the graph api). EDIT: Also tried offline_access with stream_publish. Any ideas on how to get this to work? ``` function streamPublish(imageUrl, imageHref, attachName, attachHref, attachCaption) { FB.ui( { method: 'stream.publish', message: '', attachment: { name: attachName, caption: attachCaption, description: ( '' ), href: attachHref, media: [ { type: 'image', href: imageHref, src: imageUrl } ] } }, function(response) { if (response && response.post_id) { //alert('Post was published.'); } else { //alert('Post was not published.'); } } ); } ``` `