fbs
fbsub
npm i fbsub
fbs

fbsub

Facebook Realtime API for NodeJS

by Johnson Chou

0.0.7 (see all)License:MITTypeScript:Not Found
npm i fbsub
Readme

Facebook Realtime Update API for NodeJS

Usage

Initialization

var fbsub = require('fbsub');

fbsub.init({
    appId: <APP_ID>,
    appSecret: <APP_SECRET>,
    verifyToken: <VERIFY_TOKEN>,
    callbackUrl: <CALLBACK_URL>,
});

Authentication and Subscription for Realtime Update

fbsub.authenticate(function(err) {
    if (err == null) {
        fbsub.subscribe(object, fields, function(err) {
            if (err == null) {
                // ...
                console.log('fbsub subscribe succeed!');
            } else {
                // ...
                console.log('fbsub subscribe failed...');
            }
        });
    } else {
        // ...
        console.log('fbsub auth failed...');
    }
});

Provide API for Facebook Verification Callback and Realtime Push

// Sample code is based on express@3.4.8
// 
// Verification for Facebook Request
app.get(<CALLBACK_PATH>, fbsub.verify);

// Handle Facebook Push for Realtime Update
app.post(<CALLBACK_PATH>, function(req, res) {
    // ...
});

Check Subscription List

https://graph.facebook.com/<APP_ID>/subscriptions?access_token=<ACCESS_TOKEN>

Downloads/wk

1

GitHub Stars

7

LAST COMMIT

7yrs ago

MAINTAINERS

1

CONTRIBUTORS

4

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.0.7
latest
9yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate