fb-wrapper

Highly opinionated Facebook API client for Node.js
This is a small heavily opinionated utility wrapper library around facebook-node-sdk.
It is implemented with facade pattern which translates facebook-node-sdk library's existing interface into simplified one.
Install
npm i fb-wrapper
Usage:
Only most commonly used function for interacting with Facebook API are implemented:
- postOnWall(msg: string)
- getFeed()
- getInfo(fields: string[] = ['id', 'name'])
const FacebookClient = require('fb-wrapper');
const facebookClient = new FacebookClient(
CONFIG.FACEBOOK_TOKEN,
CONFIG.FACEBOOK_APP_ID,
CONFIG.FACEBOOK_APP_SECRET,
);
try {
const msgToPost = 'Post a test message';
const postedMsg = await facebookClient.postOnWall(msgToPost);
console.log(postedMsg);
} catch (e) {
console.error(e);
}
try {
const feed = await facebookClient.getFeed();
console.log(feed);
} catch (e) {
console.error(e);
}
try {
const requestedInfo = await facebookClient.getInfo(['id', 'name']);
console.log(requestedInfo);
} catch (e) {
console.error(e);
}