Notify facebook application admin when comments are posted using social plugin - facebook

Is it possible to send notification to facebook application admins when comments are
posted using facebook social comments plugin?
Comment plugin is set up this way:
<meta property="fb:admins" content="111,222,333" />
<meta property="fb:app_id" content="123456789" />
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=123456789";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-comments" data-href="http://example.com" data-num-posts="2" data-width="470" notify="true"></div>
<script>
window.fbAsyncInit = function(){
FB.Event.subscribe('comment.create', function(response){
alert(response);
});
};
</script>
Event subscribe works pretty good in this example(shows response alert), but is it possible to send notification to application administrators?
Your help would be appreciated.

I set up a simple PHP script to email me whenever a comment is posted. The PHP is like this:
<?php
mail('me#example.com','facebook_notification.php',
'Comment activity on http://example.com'.$_GET['path']);
and this JavaScript passes the URL of the comment page to the PHP script:
FB.Event.subscribe('comment.create', function(response){
var dummyImage = new Image;
dummyImage.src = 'http://example.com/facebook_notification.php?path='+response.href.replace('http://','');
});
I can easily add more addresses if I need to.

Related

HTML code invalid. How can I add facebook messenger code with google tag manager?

Here's a code that I got from facebook chat plugin messenger.
<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
xfbml : true,
version : 'v3.3'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Your customer chat code -->
<div class="fb-customerchat"
attribution=setup_tool
page_id="my-page-ID">
</div>
Google Tag manager send me an alert, that this code is invalid.
What should I do with this?
How can I add this code with Google tag manager?

Facebook "Send to Messenger" button not showing locally

I am trying to use the Send to Messenger plugin and can't use it locally. I check some questions about hidden button and all of them was resolved after deploy.
But I need to use this plugin locally - need to get auth-callback from local .html(from chrome-extension options)
Span of "Send to Messenger plugin button" hidden if it calls locally, I try to overflow: visible - it works fine(but I think it is wrong). Can somebody guide how to use this button?
And if I checked once this button - just try to use it - it doesn't shows again with checked state is it right? or I break something?
<html>
<head>
</head>
<body>
<br> hello! <br>
<div class="fb-send-to-messenger"
messenger_app_id="APP-ID"
page_id="PAGE_ID"
data-ref="PASS_THROUGH_PARAM"
color="white"
size="large"></div>
<script src="wat.js"></script>
</body>
</html>
wat.js
window.fbAsyncInit = function() {
FB.init({
appId : '1746289228945988',
xfbml : true,
version : 'v2.7'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

Facebook comments - Moderation link not showing

I set up Facebook comments on a staging site we have, however can't get the Moderation Link to show up:
http://telegram_com.wtstage.sx.atl.publicus.com/article/20150426/NEWS/304269695?nocache=1
I have confirmed that I'm an administrator on the Facebook app account.
I have this in the header:
<meta property="fb:app_id" content="1393680337622798" />
I have this in the body:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3&appId=1393680337622798";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="http://telegram.com/article/20150426/NEWS/304269695/101116" data-numposts="25" data-version="v2.3" data-colorscheme="light"></div>
I have tried using the live telegram.com url as well as the staging url.
If I swap the url (data-href) for another site I am an administrator on, the Facebook comment moderation link shows up in the comment widget. However if I use any url that is the telegram.com's, the Moderation link does not show up.
Is there a setting or something in Facebook's backend that I could be missing? It seems to me the code would be correct, if it works when I use the same app id, but a different data-href url.
Any suggestions?
I seem to have the same issue using the data-href attribute, however, switching to the init version of the comments plugin sorted my issue.
So now, I'm using the following towards the top of the page:
<script>
window.fbAsyncInit = function () {
FB.init({
appId: '516991728450336',
xfbml: true,
version: 'v2.3',
num_posts: 5,
width: '100%'
});
};
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) { return; }
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
And I've got a
<div class="fb-comments"></div>
Further down the page. This way, I don't even need the <meta property="fb:app_id"... either, as that only overrides the appId in the FB.init script.
You can specify the href attribute in the script to modify the URL, but if you don't, it'll just default to your page URL. Further parameters here
I hope it helps.

Moderate Facebook comments

It seems I'm unable to moderate the Facebook comments of the Facebook comments plug-in.
Bellow the code that we initialy created. As you can see an appId is associated with it. Also, if you vist the page (http://amstelveenz.nl/armageddon/) there is one Facebook comment.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function () {
FB.init({
appId: '1389836761336596',
xfbml: true,
version: 'v2.3'
});
};
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="facebook-comments">
<!-- facebook comments -->
<div class="fb-comments" data-href="<?php echo get_permalink(); ?>" data-width="100%" data-numposts="5" data-colorscheme="light"></div>
<!-- einde facebook comments -->
</div>
When visiting https://developers.facebook.com/tools/comments to manage the comments I'm unable to the comments made on the website.
Also when visiting the page I don't see the moderator view.
The solution I came across quite often was to add the following lines:
<meta property="fb:app_id" content="1389836761336596"/>
<meta property="fb:admins" content="712359589"/>
Ofcourse with my app_id and user_id. This also didn't result in a solution.
Any suggestions?
You need to specify fb:admins on your site to tell us who should be able to admin the comments

Facebook comments not working on Wordpress

I added Facebook Comment Box to my site manually. I created an app and pasted the code on my template files.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '730627806953221', // App ID from the app dashboard
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK asynchronously
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Then I added this:
<div class="fb-comments" data-href="<?php the_permalink(); ?>" data-width="430" style="max-width: 100%;"></div>
It seems to work, when a user comments it displays correctly. However when I try to reply to someone who left a comment it doesn´t stay there. I´m trying to reply as a brand not as myself.
Why could this be?