Independent Tech & Cryptocurrency News
Bitcoin
$3,929.35
-47.44
(-1.19%)
Ethereum
$144.54
Ripple
$0.32
-0.02
(-4.71%)
Litecoin
$48.51
EOS
$3.77
-0.19
(-4.8%)
Cardano
$0.04
-0
(-5.49%)
Stellar
$0.09
-0
(-3.52%)
NEO
$8.80
-0.42
(-4.56%)
NEM
$0.04
DigitalCash
$85.17
-2.21
(-2.53%)
Tether
$0.99
-0
(-0.14%)
Binance Coin
$10.55
-0.86
(-7.54%)
QTUM
$2.08
-0.08
(-3.7%)
Verge
$0.01
0
(+1.3%)
Ontology
$0.72
ZCash
$53.72
-1.79
(-3.22%)
Steem
$0.33

How to build Facebook Comment Auto Reply(Private Reply) using nodeJS

3


Note: This document refers to a feature that was removed after Graph API v2.10.

Part 1: Goto your Facebook app (https://developers.facebook.com/apps)

  • Request permission for following 
    manage_pages,publish_pages,read_page_mailboxes,pages_messaging,pages_messaging_subscriptions
  • Enable “FEED” subscription (https://developers.facebook.com/apps/APP_ID/webhooks/)

Part 2: update your facebook messenger code as following:
(https://github.com/fbsamples/messenger-platform-samples)

Important note before copying the code: Don’t private reply to all the comments. Make sure you add some filters else be ready to receive a warning from FB (May suspend your app as well!!!)

app.post('/webhook', function (req, res) {
var data = req.body;
// Make sure this is a page subscription
if (data.object == 'page') {
// Iterate over each entry
data.entry.forEach(function(pageEntry) {
//Newsfeed changes webhook request
if(pageEntry.hasOwnProperty('changes')){
pageEntry.changes.forEach(function(changes){
if(changes.field=="feed" && changes.value.item=="comment" && changes.value.verb=="add"){
var messageData = {
message: "hello"
};



coindesk.com

Get real time updates directly on you device, subscribe now.

Leave A Reply

Your email address will not be published.