2

I am able to send app request using request dialog to 50 of a user's friends with to= field modification but I want to send requests to all of a user's friends like this example app does: Invite your friend button for pages

This app invites users first 50 friends than again invites users next 50 friends and so on

In my code I forward the users to this URL using PHP

https://www.facebook.com/dialog/apprequests?app_id=443468799026324
&to=" . $friend_ids .  "
&max_recipients=50&filters=app_non_users
&redirect_uri=" . urlencode($canvas_page2)  . "
&message=" . $message;

Facebook offical guide for request dialogue

How do I proceed from here?

Igy
  • 43,710
  • 8
  • 89
  • 115
Danish Iqbal
  • 215
  • 2
  • 11
  • Sounds like you are requiring your users to invite all their friends to your application... that is against FB policy... Allow your users to select certain friends to invite otherwise you stand the risk of hitting the request limit for your application... – Lix Jul 12 '12 at 07:34
  • @Lix this is not necessary if user wants he can first he click invite button and return to index page but if he click again invite button than he will found new 50 users – Danish Iqbal Jul 12 '12 at 07:36
  • @Lix can you please more explain this "Allow your users to select certain friends to invite otherwise you stand the risk of hitting the request limit for your application." is this limit for single user or for all users ? – Danish Iqbal Jul 12 '12 at 07:36
  • 1
    If each user sends each of their friends an invite - unless a large number of them accept the invite, limitations will be enforced on your application. Right now you have a certain limit of requests that your application can send per user per day. The more invites you send blindly the more risk you are at for getting negative feedback from users (that means declining requests or blocking your application) – Lix Jul 12 '12 at 07:41
  • @lix so what do you suggests for this app https://apps.facebook.com/letswinipod/ – Danish Iqbal Jul 12 '12 at 07:44
  • That application is violating FB platform policies. If FB finds out they **will** take action against that page, that developer, that account...etc... You can see a short checklist of platform policies here - https://developers.facebook.com/docs/guides/policy/policy_checklist/english/ – Lix Jul 12 '12 at 07:48
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/13771/discussion-between-danish-iqbal-and-lix) – Danish Iqbal Jul 12 '12 at 07:50
  • I'm sorry - I can not chat at this moment in time... – Lix Jul 12 '12 at 07:54
  • @Lix oh ok np. :) can you please which things are not good in this app and if i use only use this friends invites then this is good for promotion ? and what do you say about inviting all friends you saw this application what do you say if user get the invitastion from his/her friend they will join i think there is low chances of reject what do you say – Danish Iqbal Jul 12 '12 at 07:55
  • I gave you the link to the policy checklist - perhaps it would be easier in a different language - https://developers.facebook.com/docs/guides/policy/policy_checklist/. Your application needs to obide by these policies... – Lix Jul 12 '12 at 07:56
  • @lix can you please say which rules this app braking and please also see above comment – Danish Iqbal Jul 12 '12 at 08:00
  • From the **Social Channels** section - `"App does not directly reward or require users to use Facebook Social channels, such as Feed stories and Requests."` – Lix Jul 12 '12 at 08:02
  • I would reject **ANY** request of that nature - but that is just me... depends on your users – Lix Jul 12 '12 at 08:02
  • so @Lix if instead of making this step necessary in app 1.like and so on what do you say if i write do this to increase your chances of wining ? – Danish Iqbal Jul 12 '12 at 08:06
  • `"reward or require"` it's the same thing... I'm not a lawyer, so I can't give you legal advice on what to do in your application. Take those policy checklists to your companies lawyer to look at - they will be able to tell you if something is not right. – Lix Jul 12 '12 at 08:08
  • 1
    ok @Lix Thank you so much :) so nice of you :) – Danish Iqbal Jul 12 '12 at 08:09
  • @Lix: Wow! So all ****ville are basically violating FB policy. – Petr Peller Feb 18 '13 at 21:06

1 Answers1

4

You can do this as follow: First you set 50 friends id in to parameter and store remaining friends id in cookie now when you send request then it redirects to your site url where you can repeat above step.i.e. send 50 friends request and store remaining in cookie.

var to="";
    for(var j=0 ; j< 50 && j<friends.length ; j++){
        if(friends[j].checked == true){
            to += friends[j].value;
            if(j != friends.length-1 && j != 49){
                to += ',';
            }
        }
    }
    var redirect_uri=your_site_url+"?button=inviteresponse";
    var callbackto="";
    for(var i=j;i<friends.length;i++){
        callbackto += friends[i].value;
        if(i != friends.length-1){
            callbackto += ',';
        }
    }
    document.cookie = "param="+callbackto+";path=/";
    var url="https://www.facebook.com/dialog/apprequests?app_id="+app_id+"&to="+to+"&message=Checkout apps&redirect_uri="+redirect_uri;
    window.open(url,'', 'width=900,height=500,resizable=yes,scrollbars=yes');  

case "inviteresponse":
        if (empty($_COOKIE['param'])) {
            unset($_COOKIE['param']);
            echo "<script type='text/javascript'>window.close();</script>";
            die();
        } else {
            $friends = explode(",", $_COOKIE["param"]);
            $to = "";
            for ($j = 0; $j < 50 && $j < count($friends); $j++) {
                $to .= $friends[$j];
                if ($j != count($friends) - 1 && $j != 49) {
                    $to .= ",";
                }
            }
            $redirect_uri = your_site_url+"?button=inviteresponse";
            $callbackto = "";
            for ($i = $j; $i < count($friends); $i++) {
                $callbackto .= $friends[$i];
                if ($i != count($friends) - 1) {
                    $callbackto .= ",";
                }
            }
            unset($_COOKIE['param']);
            setcookie("param", $callbackto);
            $url = "https://www.facebook.com/dialog/apprequests?app_id=" . APP_ID . "&to=" . $to . "&message=Checkout apps&redirect_uri=" . $redirect_uri;
            header("Location: " . $url);
        }
Needhi Agrawal
  • 1,326
  • 8
  • 14