First, sorry for my bad English.

I've an app which is installed on multiple fanpages.

I want an apprequest dialog in this app. When the user click on invite button he sees an apprequest dialog to invite friends but the notificacion redirect to the canvas page not to app on fan page.

I use this code:

<head>
    <title>Request Example</title>
  </head>

  <body>
    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <p>
    <input type="button"
      onclick="sendRequestViaMultiFriendSelector(); return false;"
      value="Send Request to Many Users with MFS"
    />
    </p>
    <script>
      FB.init({
        appId  : '123456789',
        status : true,
        cookie : true,
        oauth: true
      });

      function sendRequestViaMultiFriendSelector() {
        FB.ui({method: 'apprequests',
          message: 'Example message',
          show_error: true,
          redirect_uri: 'https://www.facebook.com/pages/PAGE_ID?sk=APP_ID'
        }, requestCallback);
      }

      function requestCallback(response) {
        // Handle callback here
      }
    </script>

  </body>

What am I doing wrong? Configuration of Canvas Page? Redirect Uri?

Thanks!

有帮助吗?

解决方案

You're not doing anything wrong, requests are always 'delivered' to the canvas URL when accepted. You need to include some data with the requests that your app can use to decide which page to redirect to.

Easiest way to do this is to use the data parameter of the Requests dialog.

So in your request sending code:

function sendRequestViaMultiFriendSelector() {
        FB.ui({method: 'apprequests',
          message: 'Example message',
          show_error: true,
          data: "PAGE_ID_OR_SOME_OTHER_DATA_HERE",
          redirect_uri: 'https://www.facebook.com/pages/PAGE_ID?sk=APP_ID'
        }, requestCallback);
      }

Then when processing the accepted request on the app's canvas, check the data parameter of the request object (a GET request to /REQUEST_ID_HERE will return it) and decide which page to redirect to based on that

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top