paint-brush
Messenger User Acquisition: How to build Facebook Comment Auto Reply(Private Reply) using nodeJSby@b.sandesh
1,369 reads
1,369 reads

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

by Sandesh B SuvarnaOctober 7th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<strong><em>Note: This document refers to a feature that was removed after </em></strong><a href="https://developers.facebook.com/docs/graph-api/reference/v2.10/object/private_replies" target="_blank"><strong><em>Graph API v2.10.</em></strong></a>

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Messenger User Acquisition: How to build Facebook Comment Auto Reply(Private Reply) using nodeJS
Sandesh B Suvarna HackerNoon profile picture

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