Thursday, September 6, 2012

How to send additional data with fb app request.

 The Fb sendRequest has an additional "data" parameter , we can send additional data using this....We can access this value using "request id".

Send additional information using "data"  parameter.

$('#sendRequest').click(function() {
      FB.ui(
        {
          method  : 'apprequests',
          message : $(this).attr('data-message'),
          data: sessionId,
          max_recipients: '1'
        /*   filters: ['all'],*/
                },
        function (response) {
          // If response is null the user canceled the dialog
          if (response != null) {
             logResponse(response);
          }
        }
      );
    });
 
 
Access "data" parameter value.
 
 
$request_ids = $_REQUEST['request_ids'];
 
$request_data = $facebook->api('/me/apprequests/?request_ids='.$request_ids);
 
$sessionId = $request_data['data'][0]['data'];