Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Post endpoint to receive requests from Facebook'/webhook/', (req, res) => {
messaging_events = req.body.entry[0].messaging
for (i = 0; i < messaging_events.length; i++) {
event = req.body.entry[0].messaging[i];
// Check to see if the event was a message from
if (event.message && event.message.text) {
text = event.message.text
console.log(‘Heres\’s what the user said , text);
// Check to see if the event was a postback for a Facebook event -
console.log(‘Hey this was a postback!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment