Facebook post with image posted from the backend FBGraph

Hi there!

I was able to share a facebook update with this function, but I don’t know how to use facebook graph to share a status update with an image.

I’m using https://atmospherejs.com/stevezhu/fbgraph but in the docs I haven’t found a way to upload media. Have anyone figured out how to do that from Meteor’s backend?

var facebookPostText = function (shareable, onAfterFacebook) {
  console.log('------> facebookPostText');
  FBGraph.setAccessToken(Meteor.user().services.facebook.accessToken);
  var facebookUserId = Meteor.user().services.facebook.id;
  var method = facebookUserId+'/feed';

  console.log('------> about to facebook api '+ method);
  console.log(Meteor.user().services.facebook.accessToken);

  FBGraph.post(method, { message: shareable.share.text }, function (error, answer) {
    console.log('------> facebook response', answer);
    if (error) {
      console.log('Could not post on facebook', error);
    } else {
      shareable.facebookAnswer = answer;
      onAfterFacebook.apply(null, [apito]);
    }
  });
};`
1 Like

All you should need is for facebook to be able to find their tags on page.
And for that you need some kind of server side rendering.

Check how it see it on https://developers.facebook.com/tools/debug/
It gives feedback too.

I didn’t thought on the possibility of rendering server side, that a nice one to try. Thanks!

I’ll experiment with it