Question

I have incorporated a facebook login using javascript into my forum. To add a bit of value, I want when someone signs up to the forum using their facebook account, it will send a notification to the users feed in which their connections will be able to see. For example:

user3743982 just signed up for Service X. The best X Service about.

Does anybody have any good resources they could share on how to do this? I have since this done hundreds of times, but have failed in my hunt for material, tutorials, and know hows.

Thanks in advance

Was it helpful?

Solution

You can do this by calling FB.api method once you get the response object after authentication. Note that you need to get publish_actions permission in order to make publishing API calls. So, your final code must look something like:

FB.login(function(response) {
   if (response.authResponse) {
     FB.api('/me/feed', 'post', {message: 'I signed up for the service X!'});
     });
   } else {
     console.log('User cancelled login or did not fully authorize.');
   }
 }, {scope: 'publish_actions'});

You can find more information on this in the following documents:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top