This repository provides a nodejs server downloading substitutions from *.edupage.org sites and presenting them on mobile-friendly website and sending them on Messenger.
How to configure your server.
Your certificates and key should be placed in certs/
and named wsskey.pem
(key), wsscert.pem
(certificate) and cacert.pem
(CA certificate).
If you don't have SSL certificates you can generate them for free using Let's encrypt
You have to add a config
file to myModules/
. It contains data necessary to interact with Facebook.
It should look like this:
var config = {};
config.clientId = '1xxxxxxxxxxxxxx2'; //App id - displayed in app dashboard on developers.facebook.com
config.url='https://your.url'; //website url (main, used to interact with Facebook)
config.appSecret='4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc'; //App secret displayed in app dashboard
config.appToken='0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxQ'; //App token - see below
config.webhookToken='WebhookVerificationToken'; //used to verify url of your webhook - more below
config.pageToken='Exxxx...xxxxxxxxxxxxxxxF'; //Page access token - see below
config.adm1='1xxxxxxxxxxxxxx1'; //1st adminitrator messenger id (new message and new user notifications)
config.adm2='1xxxxxxxxxxxxxx8'; //2nd adminitrator messenger id (new message notifications)
config.pageId = '5xxxxxxxxxxx5'; //Page id as which bot responds (can be found on https://findmyfbid.com/)
config.db = 'myDBName'; //name of MongoDB database used for storing data
config.HTMLloc = '/path/to/folder'; //Path to folder with Vulcan substituitions in HTML (only when using vulcan.js module)
config.classes = ["2GA", "2GB", "3GA", "3GB", "etc."]; //Array of classes (currently used only by vulcan.js)
config.classrooms = ["POŚ", "PJA", "PA2", "..."]; //Array of classroom names which are not numbers (only vulcan.js)
module.exports = config; //allow other modules to access your config
Read how to generate app token.
Read how to setup a webhook and get a page access token.
To install all required modules run:
$ npm install
To start a server (listening on port 8080) run:
$ node index.js
or
$ npm start
See the LICENSE (MIT).
Facebook login datasheet.
Messenger bot.