Skip to content
This repository was archived by the owner on Nov 11, 2025. It is now read-only.

Conversation

@tarqd
Copy link

@tarqd tarqd commented Nov 8, 2012

Basically I've renamed post() to postFeed to make room for a method that allows you to POST to any graph api.

Example (uploading a picture from a url)

req.facebook.post('/me/photos', { name: 'Cool picture', url: 'http://example.com/example.png' } ,function(err, result){
     console.log('result from api : ', err, result);
});

App session support works as follows (sending a notification requires an app access token not a user access token)

  req.facebook.appSession(function(err, session){
    session.post('/1234/notifications', {href: '', template: 'Notification from app!'}, function(err, result){
      res.send("Sent notification to uid 1234!");
    });
  });

I also made it so when there's an API error it wraps up in an error object (FacebookApiError) which inherits from Error

// assume an error occurs
req.facebook.get('/me/friends', function(err, friends){
     if(err){
        console.log(err.message);
        console.log(err.type);
        console.log(err.code);
     }
});

@tarqd
Copy link
Author

tarqd commented Dec 26, 2012

Any word on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant