Search code examples
facebookinvitation

How to check number of facebook app invitation sent by a particular users?


I would like to encourage my facebook app users to invite more friends to join the app. Therefore, I will let them freely use my app after they invite more than 50 friends (no matter their friends join the app or not is also ok).

But the problem is: how can I check the number of invitation sent by that users?

Thanks.

Rgds


Solution

  • there is no built in option in facebook for this.

    I'm using the FB request dialog and whenever we send request facebook will return a set of request id's (in case of multiple simultaneous requests) .

    And then just have your own table say 'tbl_requests' where you can update the current user_id with the request_id returned by the facebook dialog.. The advantage is that you can then backtrack these request_ids when the invited person accepts his invitation.

    the sample code could be,

    function invite(){
    var receiverUserIds = FB.ui({ 
     method : 'apprequests',
     message: 'just a invite msg'
     title: 'Select your friends to join the app',
    },
    function(receiverUserIds) {
     if(receiverUserIds){  
      $.ajax({
           type: "POST",
           url: "your_file.php",
           req_ids="+receiverUserIds.request_ids,
      });
     }
    }
    );                 
    }
    

    In your_file.php process your request_ids and store them on db and then whenever you want to count the no of request sent you can just query with the current user_id