I use Facebook social comments plugin on my web page. I use event subscribe method to get the comments and save it to local database. Everything works perfectly well, except the response of comment link. Event subscribe code snippet:
window.fbAsyncInit = function(){
FB.Event.subscribe("comment.create", function(response){
alert(response.href);
});
};
Let's say I have the Facebook comments plugin on some page which url is:
http://mywebpage.com/index.php?article_id=10
So event subscribe returns the url which is equal to:
http://www.facebook.com/http://mywebpage.com/index.php?article_id=10
But that url does not exist... So what's wrong with that? How to get the correct url?
Your help would be appreciated.
The problem was with the PHP urlencode function that I used for encoding the page url before passing it to the Facebook plugin. So simply removed it and things got fixed.
Related
So, I've created a wedding event on my FB account. Now on my website (static) I would like to have a form (maybe embedded or something from FB) that a visitor could leave a message on it for greetings. That message would instantly post on the event I have created.
I hope you understand what I would like to achieve.
Is it now possible to do that? Or Is there an API for this? comment mirroring seems not applicable for events.
If it's not possible to achieve, is there an alternative that is easy to integrate on my site and of course the message will post on FB.
There are tons of APIs for Facebook, all listed on the Facebook developers documentation page: https://developers.facebook.com/docs/
But I think what you're looking for is something like this:
https://developers.facebook.com/docs/javascript/examples
Trigger a Share dialog
The Share Dialog allows someone using a page to post a link to their timeline, or create an Open Graph story. Dialogs displayed using the JavaScript SDK are automatically formatted for the context in which they are loaded - mobile web, or desktop web.
Let's make an API call to publish a message. Add the code into the response function of the FB.login call you added above:
FB.login(function(){
// Note: The call will only work if you accept the permission request
FB.api('/me/feed', 'post', {message: 'Hello, world!'});
}, {scope: 'publish_actions'});
Try the script. A status message will be posted to your timeline: Hello, world!
I'm using Facebook's share dialog with URL Redirection as shown here:
https://developers.facebook.com/docs/sharing/reference/share-dialog
Everything works fine, but the problem I'm having is that I need to get some kind of response or feedback in the redirect uri to know whether the user has published or cancelled the share.
I thought the post_id would be included as query string when redirecting. But this is not the case... I just get a trailing #_=_
So... is it possible to get somehow the response or some kind of feedback when redirecting to know whether the user has actually published the post or not?
Please also note that I cannot use the FB.ui API as the callback is
not working at all when using it inside a web mobile view.
Thanks!
I have a website with some dynamic urls (for example a page who show event details thanks to event id in get variable), but during the share with facebook, at the first attempt the thumbnail image doesn't appear due the page isn't already fetched by facebook.
Then I must go to the debugger https://developers.facebook.com/tools/debug/og/object/ and submit every pages to get a valid thumbnail to the users.
There's a script or a way to send multiple links to this debugger, or there's another way to achieve the indexing of new pages by facebook?
You can refresh the Open Graph tags with a POST request to the Graph API, i think it´s not in the Facebook docs (at least i could not find it) - but it definitely works:
$.post('https://graph.facebook.com', {
id: 'http://www.yourdomain.com/somefile.html',
scrape: true
}, function(response) {
console.log(response);
});
Just an example with jQuery, of course you can just use CURL on the server too.
I'm using Joomla in my site and I had installed Facebook Connect. My problem is that when I receive a notification that someone has replied my post, the URL is modified, so I can't see any comment.
Example:
Original Website is http://unionvecinalquilmes.com.ar/getting-started.html.
URL of the notification is http://unionvecinalquilmes.com.ar/getting-started.html?fb_comment_id=fbc_10150903622273242_25781034_10150903622413242#f19a826f4
How can I correct this problem?
You should specify the href of the comments plugin to your page URL. For example, use the base URL if your pages' base URL is always the current page URL.
I have created a static webpage and have included facebook comment plugin.
A person commented but i did not receive any notification in facebook or in my email.
What should i do to get notifications to my email when people post using facebook comment?
do i have to do something like this
FB.subscribe('comment.create', function(response){
//make an ajax request to a server side script
// and in that i can send a mail to my email... isn't it?
}
});
since that page is totally html i dont want to use any more javascripts yet if needed then i will have to use.
so is that the way to notify myself when an user posts a comment using the facebook comment plugin...
in the official documentation (http://developers.facebook.com/docs/reference/plugins/comments/) it says in the FAQ part:
How do I know when someone comments on my site?
You can subscribe to the 'comment.create' and 'comment.remove' events
through FB.Event.subscribe.
so yes, you will need to use this method to be notified on comments.