Post message on Facebook wall from Sencha touch - facebook

I'm trying to post a message on Facebook wall...
Login popup came but login button press it show a error 'Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.'
I cann't resolve this and i don't know how to post message to wall and close that popup...
Any can one please help me...
this is my code for post
FB.login(function()
{
FB.api('/me/feed', 'post', {message: 'Hello, world!'});
},
{
scope: 'publish_actions'
}),
function(response)
{
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}

I solved this issue by adding the site url and app domain.
In app details ,in settings add platform, then select website,
mentione website url as "http://localhost:1200/" and domain as "localhost"
FB.ui(
{
method: 'stream.publish',
message: '',
attachment: {
name: 'Name',
//caption: 'Caption here.',
description: (
'description here'
),
href: url
}
//user_prompt_message: 'Personal message here'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);

Related

Facebook fb.ui dialog no popup on Safari

It works fine on Firefox, Chrome and IE, but no pop up on safari and no exception and error.
Tested several safaris on different machines. Safari block pop ups by default. is there any way to unblock it automatically?
shareButton.on('click', function(e) {
// do something
shareAction();
}
function shareAction() {
// do something
share();
}
function share() {
// do something
submitShare();
}
function submitShare() {
// do something
// use the default fb.ui settings
FB.ui({
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/dialogs/',
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.');
}
}
);
}

FB.UI using imaging staging

I have a standard file-upload form, which I want to use to collect a user's image and than upload to Facebook.
If I post the upload form to the FB 'staging' url, I get the encoded staging reference - but when I try to launch a FB.UI() feed dialog, supplying the staging token as a "picture" parameter it fails?
Is the staging URL strictly for use in creating a graph object w/o using the dialog? And if I want do use the dialog do I have to upload the image somewhere else and than reference it ?
Here's my example:
$('#picture_upload').submit(function(e){
e.preventDefault();
$(this).attr('action',$(this).attr('action')+'?access_token='+accessToken);
$(this).ajaxSubmit({
success: function(response){
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
picture: response.uri,
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.');
}
}
);
} //call function after success
});
});
The response contains something like:
{"uri":"fbstaging://graph.facebook.com/staging_resources/MDAxMDE1MTU3NjIyNzExNzYwNA=="}
Which is obviously invalid as a picture parameter in the FB.UI function

name description caption don't appear in the wall post

using Facebook Javascript SDK (since FBml doesn't work anymore), posting to a wall using my facebook app does not display name, description and caption at all. I tried adding a link and display, removed description as well, none seems to fix the issue.
Any help or note on this is helpful.
var description = $(this).parent().parent().children('.description').html();
var name = $(this).parent().parent().children('.name').html();
FB.ui(
{
method: 'feed',
attachment:
{
name: name,
caption: 'Test App',
description: description,
link: appLink,
href: appLink
},
action_links:
[
{ text: 'Test App', href: 'appLink' }
]
},
function(response)
{
if (response && response.post_id)
{
alert('Post was published.');
}
else
{
alert('Post was not published.');
}
}
);
This is actually a facebook bug. I've reported it to Facebook but haven't got any feedback since December 2011 after they've confirmed it a bug and assigned medium priority. Cheers.

Publising some thing to facebook friends feeds

Salam, Hi and Hello,
I am using FB.ui method of Facebook Javascript SDK and it says, "post to your wall", I want to publish story on facebook friend's wall or in feeds. So is it possible to post story on friends feeds other than your own wall? If yes then how? I doubt that it was only possible in depreciated libraries?
I am currently using following code:
FB.ui({'method': 'stream.publish',
'from':from_user_id,
'display':'iframe',
'attachment':attachment,
'description': '',
'message': message,
'user_prompt_message': "Personailze Message",
'action_links': [
{ text: 'AppName', href: canvasURL }
]
},
function(response){
});
A Dialog is appearing but it says, "Post to Your Wall"
But What I want is that it say post to Your wall and Your Friends Home Page? as here:
http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/
I followed this tutorial but it is still saying: "Post to Your Wall"
So is there any clue? That How can I achieve the intended functionality? Waiting for your response.
thanks in advance
thanks
If you want to post on any friends wall you have to add the friends id so it'll look like this
FB.ui(
{
method: 'feed',
name: 'NAME',
link: 'LINK OF THE WEBSITE OR PAGE',
picture: 'IMAGE_URL IF YOU NEED IT',
caption: 'Reference Documentation',
description: "DESCRIPTION",
to:FRIENDS_ID
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);

Simple FB.ui Dialog

I have a fb.ui modal popup on my page to let users update their status on my page. It works great so far. Now i tested and it seems to be that the postpicture, title and description are automatically pulled from my page - I didn't define them in my script. It doesn't look very nice to be honest, and i would like to remove that for my users benetit, because it looks like they are directly advertising my page. Is there any way to have the fb.ui dialog in a simple way, only that their message will be published?
Thanks for all your kind help!
EDIT: MY CODE
FB.ui(
{
method: 'feed',
message: 'Facebook Dialogs are easy!'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
Check the fb.ui feed page for a list of parameters being passed:
https://developers.facebook.com/docs/reference/dialogs/feed/
Some options like name, description and image will be generated automatically based on your page content, you can set them to an empty string or something more appropriate from within your code.
FB.ui(
{
method: 'feed',
message: 'Facebook Dialogs are easy!',
description: '',
name: '',
picture: _some_default_picture_
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);