Search code examples
facebookapprequestsfacebook-app-requests

fb 'apprequests' redirect to new url or send additional parameter to url


I need to pass additional parameter to redirect url when the user accept fb app request or need to redirect user to a custom url. How can I do this?...Please see the following code.

   $('#sendRequest').click(function() {
          FB.ui(
            {
              method  : 'apprequests',
              message : $(this).attr('data-message')

                    },
            function (response) {
              // If response is null the user canceled the dialog
              if (response != null) {
                 logResponse(response);
              }
            }
          );
        });

Solution

  • I have used "data" parameter to send information while sending the request and accessed it in the other end using the "request id".

     $('#sendRequest').click(function() {
    
    
              FB.ui(
                {
                  method  : 'apprequests',
                  message : $(this).attr('data-message'),
                  data: sessionId,
                  max_recipients:1
    
                        },
                function (response) {
                  // If response is null the user canceled the dialog
                  if (response != null) {
                     logResponse(response);
                  }
                }
              );
            });