DeepLink in Facebook Fanpage - facebook

i'm looking for a solution to proceced deeplinks to a facebook fanpage like:
http://www.facebook.com/myfanpage?sk=app_MYAPPID&parameter=2
I need to get the value of parameter in my Fanpage app.

Use the app_data parameter in your link, and the value of this will be passed to your app in the signed_request which is sent on page load. Many developers use JSON encoded data as the value for app_data as they want to store multiple values
This is documented here: https://developers.facebook.com/docs/appsonfacebook/pagetabs/#integrating

I don't understand clearly but what you want is getting parameters from url in facebook is not possible in pagetabs i tried it many times but it won't work.
The only way getting parameters from url in facebook is creating canvas app. Because canvas apps act like domain so you can use whole parameters and urls.
If i missunderstood sorry for it.

Related

Single Facebook App multiple Client Facebook Page Tab

I have created a Facebook Application which will be used as a Facebook Tab Page. My problem is that I am unable to get the page id.
I want to use this single application for multiple Facebook Page Tabs but the content will vary based on the Page Id.
The code I am trying to use to get the signed_request is using the JavaScript SDK.
FB.getLoginStatus(function(response) {
console.log(response);
})
This can be done with the signed_request parameter, which is passed on to your URL.
The easiest solution is to use the PHP SDK. It offers a function called "getSignedRequest": https://developers.facebook.com/docs/reference/php/facebook-getSignedRequest
Those are the fields of the signed_request parameter: https://developers.facebook.com/docs/reference/login/signed-request
If you don´t want to use the PHP, you need to parse the parameter on your own. Check out this link for more information and search for "Parsing the Signed Request": https://developers.facebook.com/docs/facebook-login/using-login-with-games
Edit: you will not get the correct signed_request using the JavaScript SDK. Use PHP (or your server language) for this.
The mistake was that the URL added in the Facebook page tab settings was getting redirected as it did not have a "/"; there was a redirect for SEO added and the URL in the Facebook APP sittings did not have the "/".
So as it was getting redirected Facebook sent the POST variable but we have not handled it. Now it is fixed.
Special thanks to #luschn and #Fran Barbero for all your efforts in this.

is it possible to share whole Fb app Canvas page through app?

I'm working on a photo contest fb app to run in a fan page tab. the user should be able to share the photo in order for others to vote for them.
supposing image link in iframe is http://example.com/image.php?id=1 for particular photo, pressing share will share this link through iframe. which leads up to the host app itself.
what I need is sharing the whole fb app tab page url with http://example.com/image.php?id=1 open in its Iframe.
is that possible in any way?
thanks for help.
So to give the “alternative” to #Lix’ answer, which focuses on canvas apps, here the analog way for page tab apps:
For some reason Facebook decided to do things differently for page tab apps – different than with canvas apps, you can not pass just any GET parameters to your app by appending them to the facebook.com address of your app, but you have to use the app_data parameter for that.
You call/link to your app in the form https://www.facebook.com/YourPage?v=app_1234567890&app_data=foo – and whatever you put as value for the parameter app_data, you will find in the signed_request parameter that Facebook POSTs to your app on initial(!) load into the iframe.
So you parse the signed_request (or let f.e. the PHP SDK do that for you), and then you find the app_data value in there. If you want to pass more than one single value, you can f.e. also put JSON-encoded data there – then you have to decode that again after you read the app_data value from the signed request.
The docs just shortly mention the app_data parameter, but the principle itself is quite simple.
Now, when it comes to sharing those links, I found that when you use an address in the above form, Facebook tends to cut the parameters from the URL, and treat the whole link as just a link to your Facebook page – it shows the page’s picture and description, and does not even pass your page tab app along, let alone the app_data parameter.
I found the most reliable way around this is not to link to your page tab on Facebook directly, but instead to a URL of your own app. When the scraper visits it, you deliver the relevant OG information. And when it’s a real user visiting, you redirect them to your page tab app, passing the data you need via the app_data parameter as described above. Redirecting can either be done server-side (info on how to detect the scraper server-side via its User-Agent header), or client-side via JavaScript (which the scraper does not “speak”).
Sure it is. All you have to do is be able to extract the information from your application canvas URL. If your canvas URL is something like this:
https://apps.facebook.com/ImadBakir
Then you could place some more info in there, like this:
https://apps.facebook.com/ImadBakir?photo_id=123
Users will share that link and now in your application, you can parse that photo_id parameter and make the needed HTML changes to display the correct image inside your iframe as the page and application loads.
With regard to parsing the the URL parameters, assuming you'll be doing it with JavaScript, you can read more about it in this post:
How can I get query string values in JavaScript?

send querystring to facebook app canvas

I am trying to create facebook app, and I do not know how to pass the querystring.
How do I pass a querystring parameter to facebook app?
I have added my url to canvas url in facebook app.
http://www.pollsdb.com/get.aspx?qtnid=1&width=239&headerhight=40&height=204
I want users to be able to access different polls by changing the qtnid in the querystring.
How should I do this?
A query string you give in your canvas URL settings gets passed as it is.
If you want to link to your app from outside, you have to use the app_data parameter – everything you put in there gets passed to your app as well. If you need to transfer multiple values, JSON encode them before assigning them to app_data or something like that.

Facebook fan page app pass string to app_data and retrieve

Hi i have a multiple page facebook fan page app in asp.net c#. how do i set and retrieve that app_data querystring? is this part of the signedrequest or the actual url of the fan page? will there be cross domian issues in getting this in safari and ie?
i can get the signed_request using the following:
if (!string.IsNullOrEmpty(signedRequest))
{
dynamic SignedRequestData;
var DecodedSignedRequest = FacebookWebContext.Current.SignedRequest.Data;
SignedRequestData = DecodedSignedRequest
so basically on the first page i want to get the signed_reqeuest using the above and then append this to the url in app_data querystring. on all other requests i can then get this and use those values to check user status, liked, logged in etc. This way i think it will stop the cross domain cookie issues in safari. anyone agree or disagree with this?
has anyone done this?
cheers
You can set the app_data as:
https://www.facebook.com/{page_id}?sk=app_{app_id}&app_data={"key1":"value1","key2":"value2"}
You can pass multiple values into app_data and it will be returned in the signed_request to your actual page as (POST data).
What you should really do is get the signed_request on first page load from POST, and add it to the URL of your app as ...?signed_request={signed_request_string}. Every page should then pass this around in the URL so you can easily check the like and admin status from any sub-page. You don't need to use app_data for this. And in any case, the data will be lost after the any subsequent click / redirect in your app.

Facebook App QueryString

Up until recently our FB app was passing QueryString parameters that we used to identify app users and provide them with their data through the app. Now it just has the RAW URL without the parameters.
Did Facebook change something regarding apps? Is there something I have to do in our app?
Hi are you talking about the page link? you can get this by using FQL
eq https://api.facebook.com/method/fql.query?query=SELECT+page_id,+page_url,+fan_count,+website,+name,+username,+founded,+company_overview,+mission,+pic+FROM+page+WHERE+page_id= facebookPageId &access_token= accessToken
paste this into your browser to see a live example https://api.facebook.com/method/fql.query?query=SELECT+name%2C+fan_count+FROM+page+WHERE+page_id+%3D+19292868552