@palante/facebook-api-tools
v1.1.0
Published
facebook api tools
Downloads
6
Readme
Palante Facebook API Tools
Description
Palante Facebook API Tools is a suite of tools leveraging facebook API's for use in node.js
services. Leverages the fb
facebook libarary found here to communicate with Facebook APIs.
Installation
npm i @palante/facebook-api-tools
Modules
getProfileInfo
Get profile info from facebook based on access token and queries profile @ /me
.
import {getProfileInfo} from '@palante/facebook-api-tools';
const accessToken = 'myAccessToken';
getProfileInfo(accessToken, (err, profile) => {
// your profile logic here
});
Upsert
Updates profile records in your persistence layer. A Data Access Object (DAO)
must be passed in.
Simple DAO Example
perform your upsert logic here:
const dao = {
save(profile, callback) {
const saveProfile = saveProfile(profile);
console.log('saved profile: ', profile);
callback(null, profile);
}
};
Use in project
Import and use in project
import {fbUpsert} from 'facebook-api-tools';
const upsert = fbUpsert(dao); // pass in Data Access Object here.
upsert(accessToken, function (err, result) {
// error/result handling here.
});