Messenger User Acquisition: How to build Facebook Comment Auto Reply(Private Reply) using nodeJS

Written by b.sandesh | Published 2018/10/07
Tech Story Tags: bots | messenger | messenger-bots | chatbots | user-acquisition

TLDRvia the TL;DR App

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)

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 subscriptionif (data.object == 'page') {// Iterate over each entrydata.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"};

NOTE: Please check below if you are looking out for an open source FB/Twitter Chatbot connector.

iconicbot/iconic-narada_Open Source Webhook Boilerplate for Social Media/Messaging Platforms(Facebook, Facebook Messenger, Twitter, Twitter…_github.com


Published by HackerNoon on 2018/10/07