When I click a link which calls following function...I get
"Something went wrong. We're trying fix it as soon as possible".
It's been working for couple weeks, and has started behaving like this, for last week.
Did I change anything?, probably yes. But, the same code works on another non-production, test fb-app-settings!!
Here is the javascript.(There's no javascript error on the page)
I need help figuring out what's wrong or where to look! I've waiting couple days, but still same problem.
function publishReview() {
var atch = {
name: 'Raajneeti - Movie Review',
href: 'http://www.moviereviewsindia.com/Movie.aspx/Details/Raajneeti',
caption: '{*actor*} just revealed his taste of a movie',
description: 'Write, Read and Share movie reviews just through your Facebook Account',
media: [{ type: 'image', src: 'http://moviereviewsindia.com/Content/Images/logoround.png', href: 'http://www.moviereviewsindia.com'}]
};
FB.ui(
{
method: 'stream.publish',
message: '3/5 - Multi-starrer raajneeti was good but not great, and a very good efforts from Prakash Jha. A lot happened in 3 hours. I recommend to hire ajay devgan for car wash. Nana patekar was rocking as usual in his unusual style. Take him out and your movie experience may deterior. Ranbeer got a nice role of ARJUN, and he was characterized nicely in the movie. I can\'t say whether he was that great in acting. Story was good enough, but don\'t expect total real life thingy there. ',
attachment: atch,
action_links: [
{ text: 'My Reviews', href: 'http://www.moviereviewsindia.com/User.aspx/Profile/1266802272' }
],
href: 'http://www.moviereviewsindia.com/Movie.aspx/Details/Raajneeti',
user_prompt_message: 'Share your thoughts about ' + 'Raajneeti - Movie Review'
},
function(response) {
if (response && response.post_id) {
//success action
} else {
//failure action
}
}
);
}
I tried with shorter FB.ui.message. And that worked. I wonder if there is any defined length limit for this message.
Related
I'm messing around with an Angular app, let's say for the sake of argument that I'm not using any meta tags, how can I use the Share Dialog to let users share pages of my app?
Using the old Feed Dialog works, but it has been deprecated:
$scope.share = function() {
FB.ui({
method: 'feed',
name: 'This is the name field',
link: 'The link',
picture: 'The picture',
caption: 'The caption',
description: 'This is the content of the "description" field, below the caption.'
})
},
function(response) {
if (response && !response.error_code) {
console.log('Posting completed.');
} else {
console.log('Error while posting.');
}
});
};
So even though this works, I want to use the Share Diolog in the same way but I'm not figuring it out. This is sort of what I've been trying, keep in mind that I'm a newbie:
$scope.share = function() {
FB.ui({
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object: {
'title': 'The title',
'image': 'An image',
'url': $scope.shareUrl,
'description': 'This is the description',
}
})
},
function(response) {
if (response && !response.error_code) {
console.log('Posting completed.');
} else {
console.log('Error while posting.');
}
});
};
Any hints?
The short answer is that you can't, you must use OpenGraph meta tags.
Since Facebook doesn't understand JavaScript and thus Angular, you must detect Facebook's crawlers server-side and render a static page for them instead of the Angular app.
While the precise implementation will vary depending on your server technologies, here's the general idea:
Setup a route for the resources that need sharing: http://example.com/resources/:id
Look for the user-agent
If it's one of Facebook's crawlers, fetch the resource and render a simple view with OpenGraph tags and an empty body. Otherwise, simply render the Angular app.
Facebook's crawlers are available here and they currently are:
facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
facebookexternalhit/1.1
Facebot
I'm working on publishing stories with Facebook Open Graph, for this I'm using their JS SDK. Docs is here : https://developers.facebook.com/docs/opengraph/overview
So the point is to publish for a user : John Smith is listening Shakira - Lalala on Mywebsite.
listening is the action
Shakira is the object
The JS code would be:
FB.api(
'me/mynamespace:listen',
'post',
{
song: "http://mywebsite/shakiramusic"
},
function(response) {
// handle the response
}
);
In this page, some others informations will be specified with code like this:
<meta property="og:title" content="Lalala" />
<meta property="og:image" content="wonderShakira.jpeg" />
But, here is my problem. Imagine that I would like to make a Stories like :
John Smith is reading page 542 from a BigBook on mywebsite
The page number is highly variable and so can't be stock in meta property because Facebook won't refresh it in time.
So I would like making something like that:
FB.api(
'me/mynamespace:reading',
'post',
{
object:{
app_id: 1234567890,
type: "book",
url: "http://mywebsite/thebigbook
title: "The Big Book"
image: "bigbookcover.png",
description: "A super book",
** page_count:542 **
}
},
function(response) {
// handle the response
}
);
But of course it's not working and i get an error. May be i misunderstand the principe of custom stories, actions and objects... I hope my problem is clear and you'll be able to help me.
Thanks :)
I got the answer, here is the good code:
FB.api(
'me/mynamespace:reading',
'post',
{
book:{
app_id: 1234567890,
type: "book",
title: "The Big Book"
image: "bigbookcover.png",
description: "A super book",
url: "http://mywebsite/thebigbook
page_count:542
}
},
function(response) {
// handle the response
}
);
There is two things to consider:
you need to send an object call book for reading and you need to put the url parameter in last, otherwise, Open Graph will get the value in the meta tag. If you put it last, OG will take the parameter that you send.
I have a FaceBook game that is done in SilverLight. It makes a call to JavaScript from the SilverLight HTML bridge. I do not want an UI that asks the user for a comment, I just want their score that was passed from the SilverLight app to post on their feed. The following code does nothing. It does not throw an exception, but does exactly nothing.
Any help you can send my way that will explain how to fix this so that it posts to a users feed without UI would be greatly, greatly appreciated.
function PostToFeed(strCaption)
{
function callback(response)
{
}
var obj =
{
method: 'stream.publish',
// was using method: 'feed',
link: 'https://apps.facebook.com/blackjackguru/',
picture: 'https://metamorphosisapps.com/blackjackguru/BlackjackIcon.gif',
name: 'Blackjack Guru Accomplishment',
caption: strCaption,
message: 'I love this game!',
description: 'Play blackjack with the best blackjack game on FaceBook.'
};
FB.ui(obj, callback);
}
var obj =
{
link: 'https://apps.facebook.com/blackjackguru/',
picture: 'https://metamorphosisapps.com/blackjackguru/BlackjackIcon.gif',
name: 'Blackjack Guru Accomplishment',
caption: strCaption,
message: 'I love this game!',
description: 'Play blackjack with the best blackjack game on FaceBook.'
};
FB.api('/me/feed', 'post', obj , function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
have you tried this? this just posts to user feed without any questions :)
I'm trying to make my facebook application autopost to a wall after they have accepted the permissions, ived tryied alot of things but i just cant get it working.
This is one of the things ived tryid:
FB.ui(
{
method: 'feed',
to: friendId,
name: 'title',
link: 'http://host.com/title_link.com',
picture: 'http://host.com/image.jpg',
description: 'description',
caption: 'caption',
},
function(response) {
// Check for a posting to wall
if (response && response.post_id) {
// do some logging
}
}
});
Is there anyone that got a sample code :)?
Maybe, your example is not working because there is one comma too much after
caption: 'caption'
.
I trying to bulid a facebook application using javascript.In my application, the user gets the result and a dialog after a time delay popup. Everthing is working well except one here's my code for the 'post to wall dialog'
<script>
var publish = {
method: 'stream.publish',
display: 'popup', // force popup mode
attachment: {
name: 'Connect',
caption: 'The Facebook Connect JavaScript SDK',
actions: [{ name: 'action_links text!', link: 'http://www.example.com' }],
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
),
href: 'http://www.example.com/'
}
};
FB.ui(publish, Log.info.bind('stream.publish callback'));
</script>
The line containing actions not working for me.Can anyone just inform what is the solution for this...
The property should be called action_links not actions and only have text and href values. Use something like:
action_links: [{ text: 'action link test', href: 'http://example.com'}]
Note that the action must be defined through the fb web interface for the app!