Update: Minor modifications for meteor 0.6.0
You need to use the API to help you, for example, the nodefacebook api diagram: https://github.com/criso/fbgraph
You will need to make a package. You need to create a directory called /packages and in this directory called fbgraph .
Each package requires package.js (placed in the fbgraph directory). In package.js you can use something like:
Package.describe({ summary: "Facebook fbgraph npm module", }); Package.on_use(function (api) { api.add_files('server.js', 'server'); }); Npm.depends({fbgraph:"0.2.6"});
server side js - server.js
Meteor.methods({ 'postToFacebok':function(text) { var graph = Npm.require('fbgraph'); if(Meteor.user().services.facebook.accessToken) { graph.setAccessToken(Meteor.user().services.facebook.accessToken); var future = new Future(); var onComplete = future.resolver();
Then when logging in to the client
Client side js
Meteor.call("postToFacebook", "Im posting to my wall!", function(err,result) { if(!err) alert("Posted to facebook"); });
Fbgraph repo: https://github.com/criso/fbgraph
API Charts API Docs for Query List: https://developers.facebook.com/docs/reference/api/
Async (Waiting for a callback from facebook before returning data to the client): https://gist.github.com/possibilities/3443021
source share