Share Your Facebook Apps by Sending Requests to Friends

Facebook Platform provides some useful Social Channels that allow users to share with their friends with your App easily. One of the Social Channels is Requests.

Requests are a great way to enable users to invite their friends to your App or to take some specific actions, for example, complete a survey, social gathering, etc…  The following simple example shows the most basic codes to display a Request Dialog within a canvas page of a Facebook App:

<?php 

         $app_id = "YOUR_APP_ID";

         $canvas_page = "YOUR_CANVAS_PAGE_URL";

         $message = "Hi! I am testing with my Facebook App.";

         $requests_url = "http://www.facebook.com/dialog/apprequests?app_id="
                . $app_id . "&redirect_uri=" . urlencode($canvas_page)
                . "&message=" . $message;

         if (empty($_REQUEST["request_ids"])) {
            echo("<script> top.location.href='" . $requests_url . "'</script>");
         } else {
            echo "Request Ids: ";
            print_r($_REQUEST["request_ids"]);
         }
?>

Note:
Replacing the YOUR_APP_ID and YOUR_CANVAS_PAGE with the correct values found in the Developer App.

When user click on the Request link on the Canvas page, the following screen will appear:

You can then send request to the selected friends, inviting them to the App. The maximum number of friends that can be sent each time are 50. If you wish to send to more than 50 friends, you have to send more than one time by selecting different friends each time. Of course this can also be done by writing some codes.

After the Request has been sent, the message will appear in the notification of your friend’s Facebook.

By clicking on the message, it will then direct to your Facebook App. Therefore Request allows users to share your Apps with their friends in a much easier way.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>