How to post Flash applets to a wall on Facebook? - facebook

In the comments of this question, users have commented that it's possible to insert a Flash applet into a Facebook wall post. I was under the impression this isn't possible without making a FB app.
I'm aware that FB will convert links to various media types - e.g. a link to a MP3 becomes automagically a SWF MP3 player, but the Flash applet used is chosen by FB's internal logic, not by the content of the post. Is it possible to embed a SWF applet of your own choosing?
As I haven't been able to find any documentation on this, has anyone else? Or, do you have some PoC code that does this?

you can use the Facebook's JS-SDK for it:
FB.ui(
{
method: 'feed',
name: 'Title pf post',
link: 'http://link.to.target',
picture: 'http://link.to.previewimage',
source: 'http://link.to.swf',
caption: 'Subtitle',
description: 'Maintext',
},
function(response) {
if (response && response.post_id) {
//alert('Post was published.');
} else {
//alert('Post was not published.');
}
}
);

As you said in the comment of the other question, that you were also interested in how to pass parameters to the swf, here is the solution:
in javascript
function postOnWall(fbuid) {
var params = {};
params['message'] = "my message";
params['name'] = "my name";
params['description'] = "my description";
params['link'] = "https://www.mylink.com";
params['caption'] = "my caption";
params['picture'] = "https://www.mylink.de/thumb.png";
params['source'] = "https://www.mylink.de/Main.swf" + "?bla=thisisyourdynamicquerystring";
FB.api('/' + fbuid + '/feed', 'post', params, function(response) {
if (!response || response.error) {
// Error occured while publishing to stream
} else {
// Published to stream
}
});
}
in actionscript
public function Main() {
this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
}
private function loaderComplete(event : Event) : void {
var myQueryStrings : Object = this.loaderInfo.parameters;
if (myQueryStrings && myQueryStrings.bla) {
_myMovie.label.text = myQueryStrings.bla;
}
}

Related

How can I use FB.ui to create unpublished post

I have been trying to use fb.ui to create an unpublished post. Cant find any documentation for it. Is this possible with v2.8 ?
I don´t think you can do it with FB.ui dialogs (and scheduling is only possible for Pages anyway), but it is possible with FB.api:
const params = {
access_token: <pageToken>,
published: false,
message: 'some text',
scheduled_publish_time: <timestamp>
};
FB.api('/<pageid>/feed', params, (response) => {
if (response && response.error) {
} else {
}
});

how to upload image with feed using FB.api method

we are using Fb API for post feed on facebook.
my code is -
if (response.authResponse) {
var data =
{
name: "link to apply",
picture: 'http://www.hrgp.biz/Uploads/CompanyForTesting_499/NotesReminders/2608chemtec-logo.jpg',
link: "http://www.hrgp.biz/bc0efdb3-f1a7-4d81-9635-d1418e808b6d.aspx", // Go here if user click the picture
description: "thank you"
}
FB.api('me/feed', 'post', data, function (response) {
if (!response || response.error) {
alert(JSON.stringify(response.error));
} else {
//alert('Post ID: ' + response.id);
alert('feed posted successfully.');
}
});
}
}, { scope: 'email,user_likes,publish_actions,publish_stream,read_stream,photo_upload' });
This code Works but I’m having issues with the picture. It doesn’t show up in the post.
how can i resolve this issue?
or
please tell me if any problem into my code.
thank you..!!!
Please refer to What is the minimum width and height Of Facebook Open Graph Images?.
The ratio of both height divided by width and width divided by height
(w/h, h/w) cannot exceed 3.0.
Your photo, http://www.hrgp.biz/Uploads/CompanyForTesting_499/NotesReminders/2608chemtec-logo.jpg, 250/65 = 3.84615384615 obviously exceed the maximum ratio:
FB.api('me/feed', 'post', { message: body,
picture :'PICTURE_URL',
description : "DESCRIPTION"
}
, function (res) {
if(!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
console.log('Post Id: ' + res.id);
for more options check - https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed

Post a public message in Facebook with FB.api

I have tried to post a message on my wall using FB.api(). I posted it successfully but it's showing only for me. I want to make this post public.
In app Configuring permissions i set "Default Activity Privacy" value Public but still message posting private.
I tried to do it by following code:
FB.login(function (response) {
if (response.authResponse) {
var privacy = { 'value': 'EVERYONE' };
var txt = 'my post to test feed post using api';
FB.api('me/feed', 'post', { message: txt, privacy: privacy }, function (response) {
if (!response || response.error) {
alert(JSON.stringify(response.error));
} else {
alert('Post ID: ' + response.id);
}
});
}
}, { scope: 'email,user_likes,publish_actions,publish_stream,read_stream' });
Please check my code.
As said in reference 'privacy' field value should be string.
Try to pass "{ 'value': 'EVERYONE' }" as string, not an object.

Sencha Touch and Facebook button

I need to create a button to submit a comment on Face Book wall.
I am using MVC in Sencha touch and in my controller I use a function as
facebookComment: function()
{
--------
}
This function is to be called when a button is pressed.
Can any body please throw some light on how to go about this?
i am using following code to post on friends wall see if it is useful to you or not
var postParams = {
method: 'stream.publish'
, target_id: friend_id
, display: 'popup'
, message: message
, user_message_prompt: "Post message!"
}
FB.api(postParams, function(response) {
if(response.error_code || !response) {
to handle error
}
});
or refer this link https://developers.facebook.com/docs/reference/rest/stream.publish/
Well, first you should already be using the Javascript SDK. Then just issue a HTTP POST request to the feed connection of the current user using the FB.api() method with the message field set to your comment:
var body = comment_var;
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
Obviously, should be taking care of the user login status (maybe using the method FB.getLoginStatus()).

Is there a way to post a message to a Facebook group's feed?

I'm working on a Facebook app that uses Facebook groups, and I'd like to open up a Feed dialog to let the user post a notice to the group's feed. I have a user who is in the group and I've got the relevant permissions as well.
I've tried passing the group's Facebook id in the https://developers.facebook.com/docs/reference/dialogs/feed/ feed dialog, but get a Facebook error. There doesn't appear to be a programmatic way to do it either: the group's feed (described at https://developers.facebook.com/docs/reference/api/group/) isn't documented to accept POSTs either. Is there a way to post a message to the group using the Graph API or one of the other API methods?
I just made a test and it's working as any other wall.
I made a POST to 'GROUP_ID/feed' with a message variable with a value and it worked. I logged into the app as the group owner.
Using facebook php-sdk:
$facebook->api('GROUP_ID/feed', 'POST', array(
'message' => 'Testing...'
)));
I would suggest to use javascript instead as it wont cause post back of our website.
Check out my application to see if that what you want -> WooTube
function Promote() {
var lnk =
'http://www.wootube.woolei.com?v=<?php echo $_GET["id"] ?>';
FB.login(function(response) {
if (response.authResponse) {
//Post To WooTube Group
FB.api('/271691796276524/feed', 'post', {
message: lnk,
link: lnk,
},
function(response) {
if (!response || response.error) {
//alert('You have to join the group first!');
} else {
//alert("Successfully Posted to WooTube Group!");
}
});
//Post to Wootube Page
FB.api('/173724382762792/feed', 'post', {
message: lnk,
link: lnk
},
function(response) {
if (!response || response.error) {
//alert('You have to like http://www.facebook.com/WooTubes first!');
} else {
//alert("Successfully Posted to WooTube Page!");
}
});
} else {
alert('Not logged in');
}
}, {
scope: 'publish_stream'
});
}