m-cakir / fb-messenger-bot

Facebook Messenger Bot with Express JS (Node.js)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facebook Messenger Bot

A simple messenger bot server client with Express.js.

Installation

Let's consider your domain is mydomain.com.

The client handles facebook webhook with the following path.

mydomain.com/facebook

GET     : Validating webhook
POST    : Received message callback

If you wanna change the path, just edit the following code in app.js file.

app.use('/facebook', facebook);

Set config properties in config/config.json file.

{

  "log_active": false, // is logging enabled?

  "facebook"  : {

    "api_token"     : "MY_FACEBOOK_API_TOKEN", // page access token

    "verify_token"  : "MY_HUB_VERIFY_TOKEN" // verify token for validating webhook

  }

}

Then write your code in api/bot.js file which has the following callbacks.

onText			: text callback
onQuickReply	: quick reply callback
onAttachment	: attachment callback (image, audio, location etc.)
onPostback		: postback callback

About

Facebook Messenger Bot with Express JS (Node.js)


Languages

Language:JavaScript 97.2%Language:HTML 2.1%Language:CSS 0.8%