node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »

social-api

Social API

Social API is a NodeJS library that makes it easier to query various social sites' APIs.

Support

The support is currently limited, due to the project being under development.

The syntax, method names and parameters names are not stable.

Push requests are welcome.

We partially support:

  • Facebook page
  • Twitter
  • Instagram
  • Github

Setup

npm install social-api

var socialApi = require('social-api');

Facebook

Page

var page = new socialApi.facebook.page({
    appid: "App ID",
    appsecret: "App Secret",
    uid: "User UID",
    authtoken: "user Authtoken"
}, function(pageInstance) {
    pageInstance.list(function(fbpages) {
        // fbpages is an array of facebook pages owned by the user
    });
}

Instagram

var instagram = new socialApi.instagram({
    clientId:        "App ID",
    clientSecret: "App Secret",
    token:         "user Authtoken"
}, function(instagramInstance) {
    instagramInstance.recent(function(pictures) {
        // pictures is an array of pictures posted by the user
    });
}

Twitter

var twitter = new socialApi.twitter({
    consumer_key:           "consumer_key",
    consumer_secret:     "consumer_secret",
    access_token_key:       "access_token_key",
    access_token_secret: "access_token_secret"
}, function(twitterInstance) {
    twitterInstance.timeline('username', 20 /*count*/, function(tweets) {
        // tweets is an array of tweets posted by the user
    });
    twitterInstance.followers('username', 20 /*count*/, function(followers) {
        // followers is an array of the user's followers
    });
}

Github

var github = new socialApi.github({
    token:         "user Authtoken"
}, function(githubInstance) {
    githubInstance.repositories(function(repositories) {
        // repositories is an array the user's repositories
    });
    githubInstance.orgs(function(orgs) {
        // orgs is an array the user's organizations
    });
    githubInstance.gists(function(gists) {
        // gists is an array the user's gists
    });
}