简体   繁体   中英

Notification not sending to facebook friend

I have created an application where i am trying to invite friends via facebook invite friends js method but all working fine but no notification sent to that friend.

My Application Link: http://www.huzoorbux.com/fl/app/android/www/homepage_nopost.html

My Code:

<script src="http://connect.facebook.net/en_US/all.js"></script>
        <script>
        FB.api(
    "/me/invitable_friends",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
        if(top.location != self.location) {
                top.location = self.location
            }
            FB.init({
                appId:'228877127299395',
                cookie:true,
                status:true,
                xfbml:true
            });

            function FacebookInviteFriends()
            {
                FB.ui({
                    method: 'apprequests',
                    message: 'Join My Job Buddy'
                });
            }
        </script>

<a href='#' onclick="FacebookInviteFriends();"><div class="connectbutton5" id="ol">Invite Friends</div></a>

App Requests are for games only, that may be the reason. And always use a callback function for error handling, maybe you are missing an error:

FB.ui({method: 'apprequests',
    message: 'YOUR_MESSAGE_HERE'
}, function(response){
    console.log(response);
});

Also:

The invitable_friends API is only available for games that have a Facebook Canvas app implementation using version 2.0 of the Graph API.

Source: https://developers.facebook.com/docs/games/invitable-friends/v2.1

If you want to invite someone to a website, use the Send and Share Dialogs and Buttons. You don´t even need to authorize the user for them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM