2

I can send requests to friends using "Multi Friend Request Selector" inside my Page Tab App, which link looks like :

https://www.facebook.com/<my_page_name>/app_<my_app_id>

My friend receives my request, and click "Accept". It forwards to the real link of the Facebook App, which is :

https://apps.facebook.com/<my_app_name>/?fb_source=request&request_ids=<an_request_id>

which is not inside a Page Tab anymore. How can I forward to user to the 1st link instead of the 2nd while the request_ids have to be kept? Do I just make a header('Location: url'); forwarding?

p.s. Timeline is already in use.

Raptor
  • 53,206
  • 45
  • 230
  • 366

1 Answers1

4

Yes you have to forward to your page url, because requests always redirect to the canvas url.

To pass the request ids you can use the app_data field. So instead of redirecting to https://www.facebook.com/<my_page_name>/app_<my_app_id> you redirect to https://www.facebook.com/<my_page_name>/app_<my_app_id>?app_data=requestids. Here requestids are the actual values(the comma separated list that the canvas gets).

app_data is available to your page tab app as part of the signed_request it receives.

From docs:

In addition, your app will also receive a string parameter called app_data as part of signed_request if an app_data parameter was set in the original query string in the URL your tab is loaded on. For the Shop Now link above, that could look like this: "https://www.facebook.com/YourPage?v=app_1234567890&app_data=any_string_here". You can use that to customize the content you render if you control the generation of the link.

Juicy Scripter
  • 25,778
  • 6
  • 72
  • 93
bool.dev
  • 17,508
  • 5
  • 69
  • 93
  • 1
    Almost perfect answer. The redirect link should be: `https://www.facebook.com//app_?app_data=requestids` and PHP `header('Location: url')` does not work in this case. Need to use client-side JavaScript redirects. – Raptor Apr 02 '12 at 01:57
  • 1
    glad it helped..i didn't mention anything about `header` coz it does work sometimes, (when you haven't sent any output to the browser yet), afaik. the url, i wasn't so sure about this form of it, i'm used to the older style, `https://www.facebook.com/YourPage?v=app_1234567890&app_data=any_string_here` . anyway thanks, i learnt something too. – bool.dev Apr 02 '12 at 07:35
  • FYI, both format of URL works, but Facebook seems to prefer my version after changed to Timeline, as it is the default link format of Timeline. – Raptor Apr 02 '12 at 07:53