Facebook php API and app_data parameter - facebook

I am building an application for Facebook that needs to be able to retrieve some custom parameters. I read that app_data is my solution and that I can easily retrieve the data I need by putting them there.
Now, I have made a custom page tab dialog that work great - really.
$response = $facebook->api("/".$pageWhereToInstallApp."/tabs","POST",array ('app_id' => $appID,'access_token'=>$accessToken));
As far as I've understood it the app_data parameter needs to be passed when the page tab is created. But, I can't find anywhere how I specify this parameter in the above code.
Any help is much appriciated.
Thank you.
/Jacob

As far as I've understood it the app_data parameter needs to be passed when the page tab is created.
That’s wrong (and would not make much sense, because that way it would be a rather static parameter).
You have to pass it when you link to your page tab app from somewhere external:
https://www.facebook.com/pagename/app_0123456789?app_data=foo

Related

How to use URL parameters in Flutter Web?

I want to make it so when a user enters the URL of the app they'd get the same page, no matter what they added after the '/', but have a string stored in the code with the value after the '/'.
for example: if they enter the URL "exampleurl.app/blabla", the String would have the value "blabla".
I managed to that somewhat with Uri.base, the problem is that after the app loads the URL removes all the text after the '/' automatically, and whenever I reload the site it reloads it without the URL with the text removed.
Also if the current URL in the tab is already of the app ("exampleurl.app/nomatterwhatsaddedhere"), it assumes that it is the same URL and doesn't even reload.
It would be greatly appreciated if someone could show me a way to get the string from the URL without these issues.
Thanks in advance!
You need to use Navigator 2.0 for this kind of functionality. I recently wrote a short series that explains simply how to implement Navigator 2.0. It goes into detail explaining how to work with the URL in an app for similar functionality to what you are after, though you will need to tweak it for your use case. It provides a detailed walkthrough along with sample code available on GitHub.
A Simpler Guide to Flutter Navigator 2.0

Clear render parameters on WebSphere Portal

I need WebSphere Portal to clear Render Parameters on page change. What's happening now -and it's a Navigational State feature of the product- is that the render parameters that I used in some URL's are being encoded in the URL, so even after I leave the page when I return my render parameters are still there.
You can try some of the options from the link below if you're allowed to create friendly urls or modify the theme navigation to use keepNavigationalState attribute.
http://www-01.ibm.com/support/docview.wss?uid=swg21586973
Edit: I looked up the portlet code where I thought I removed parameters from a RenderRequest. I actually was using the PortletSession to move an attribute from a processAction method to the doView. I then removed attribute from the session so it wouldn't be used on a page refresh. It's kind of a hack and you will need to turn on public session to support anonymous users ( http://publib.boulder.ibm.com/infocenter/wpdoc/v6r0/index.jsp?topic=/com.ibm.wp.exp.doc/wps/srvcfgref.html - Go to Navigator Service) but it's another option to think about.

How to get the Facebook iFrame Tab url (including parameters) from within the app?

I think there are a few similar questions that seem to suggest using app_data in the signed request (http://developers.facebook.com/docs/authentication/signed_request/) but I'm not sure if it will be possible to do what I am trying to achieve with it as I've never used it before.
If I have my Facebook 'Tab' Url as follows:
http://www.facebook.com/pages/PAGE_TITLE/PAGE_ID?sk=app_APP_ID
What I want to do is add an extra parameter on the end as follows:
&WT.mc_id=email-uk-8014
The reason for this is for tracking purposes and links will be sent out of the form
http://www.facebook.com/pages/PAGE_TITLE/PAGE_ID?sk=app_APP_ID&WT.mc_id=email-uk-8014
and the extra parameter will allow us to track the campaign id.
As you can see I have no way of knowing the value of the parameter beforehand as it depends on the link clicked by the user so is it possible to somehow get the value of the WT.mc_id parameter inside my iframe app?
app_data is the only parameter passed through other than the page ID and user's basic details (locale and if they do/don't like the page) - you'll need to use that for any sort of campaign tracking (or link elsewhere and redirect to the tab after capturing your analytics data)
you can pass get variables in facebook but only in canvas application
you just have to use $_REQUEST['xxx'] to retrieve the data.
you should not pass the param in href of facebook. Instead just make linking inside your app so that you can track the events. As you will be in iframe and having complete control you can do same on your own site.

Facebook App Setup

I created FB application that use iframes, and it's working okay, as it should, BUT I need to check from what page is calling it.
I want different pages to pass different variables to that iframe location.
I already know how to set up it to three levels ( original page, application page, and on tab page, with different display content ), but I need to check from what page it's called.
I am thinking that it can be done in 2 ways:
1 way: Find way to pass specific variable based on page that is using this application as tab, and then redirect it to right location
2 way: Find way to create new application outside facebook ( maybe API or something ) and then enter all those values including: App name, app link that have this variable included, app tab link, using iframe and not FBML...
I will love to use 2. way...
I'm not asking you to show me code, I know that I need to do my job, I'm not asking you to do it for me, I'm just asking for help, for directions from someone who already create something like this, to point me to right direction where can I find way...
Also, please don't tell me to read bunch of stuffs, like FB Documentation or whole book that have all other "not-used-here" stuffs, I need specific part where there is a word about this...
If someone know anything about this, write it here...
Thank you!
The "page" parameter is passed along within the "new" signed_request parameter on (iframe) tabs. You get what you need for "free" ;)
page: A JSON object containing the page
id string, the liked boolean if the
user has liked the page, the admin
boolean if the user is an admin. Only
available if your app is an iframe
loaded in a Page tab.
http://developers.facebook.com/docs/authentication/signed_request/

Passing php variables to Facebook Application Tab

Are you able to send php variables to a application in a tab (in facebook)?
I have built a system which sends a wall post to a friend, which includes a link with a php variable in it. This variable needs to be processed by the app, but I cant work out how to (or if I can) do this.
Yes, you can pass URL Parameters to an iFrame Tab App.
Pass the parameter: http://www.facebook.com/MyPage?sk=MyApp&app_data=any_string_here
Receive the parameter: $app_data = $signed_request["app_data"];
See more:
http://forum.developers.facebook.net/viewtopic.php?id=92661
I think this is a duplicate of the following question:
Facebook Application Tab -> External Linking with PHP
It does not seem to be possible to pass URL parameters into a Facebook application that is in a Tab. You can do it on the Application page however.
Edit: as per the answer below, this behaviour has changed. Details here: http://forum.developers.facebook.net/viewtopic.php?id=92661