Facebook App Insights don't reflect changes at likes and comments - php

I'm trying to develop a Facebook App that works using Unity3D as front-end but using a PHP Web server to do the Facebook request saving the private key there.
I tested various things like uploading photos and comments an then it get reflected the new App Insigths of the App as Stories Published.
The thing I can't achieve is to see the Likes and Comments of those Stories, it remains 0.
¿There is something that I don't understand about the Likes/Comments there, or I'm doing something bad?
Thank you all.
P.D: Sorry about my English ^^'
Edit:
I can't provide example code of what i've done but I can explain it.
Actually my front-end do get requests to a backend PHP server that do the requests to Facebook.
When a user want to log in the server return the login url in a string and the front-end launches a Internet navigator (in my case is Google Chrome).
The callback url given to Facebook go to a site that closes automatically the navigator and putting in first plane my front-end.
From there you can do the request to the back-end to publish stories in Facebook and then log-out
Actually this is what my application do and it works. The only problem is that the comments and likes that those stories got are not reflected in the App Insights section.

Related

What is Facebook app canvas and page tab?

I have spent a lot of time reading FB dev docs and tutorials but I am still very confused with what canvas app and page tab are and how to use them.
What I am expecting from using FB SDK in my site is to have "continue with facebook" button on login screen , have a couple of share and like buttons and send notifications to facebook if user have allowed that. My site has internal messaging system and I want to notify users that new message or activity has happened in my site. In this way users would not have to check my site every day for activity which is important user experience as I expect rare activity(approx. few activities per week).
I have everything running but after user clicks on notification he is taken to canvas app. FB docs and tutorials focuses on code examples but I have not found anywhere description on what canvas app really is. Without this fundamental understanding I can not complete my notification logic, can not understand the terms involved like "secure canvas url" and basically does not feel confident about user experience(which I would want to make as great as possible).
If I google "what is facebook canvas app" I get "Canvas is an immersive and expressive experience on Facebook for businesses to tell their stories and showcase their products.". Apparently from comment below thats something else...
I would appreacite If someone could explain in plain word and maybe example what is canvas app and how should I use if taking into account that my main goal is to notify users about acitivity in my site to their fb account.
I am using CI framework PHP SDK v5.
Background
In Facebook, you create "apps" that run on "platforms". As a quick, very simplified summary, the three primary types of "platforms" that apps can run are:
A website that you host and control, but integrated with the Facebook Graph API (has Facebook Login, posting etc), but otherwise looks like a normal website. You host these on your own servers.
A website designed to sit inside an iFrame on the Facebook Platform. These apps will also generally interact with Facebook Graph. You still host them on your own servers but you have the added advantage that but can get limited information about the user when the page loads.
Stand alone programs (including mobile applications) that also interact with the Facebook Graph.
What you are talking about is the second of these - the iFrame on Facebook.
Facebook provide two ways to embed the application iFrame:
one is a canvas app. This has minimal surrounds for Facebook Header, Footer and a few ads on the right. It maximises your space. (e.g. https://apps.facebook.com/candycrush/?fbs=-1&fb_appcenter=1)
the other is a "page tab" (https://developers.facebook.com/docs/pages/tabs). This is smaller and designed to sit in a company's "Facebook Page" so has less space. As a marketer, however, it keeps everything more branded to your company. (Example: https://www.facebook.com/NutellaANZ/app/595447743881506/)
Note that a single app can run across all the above - canvas, a page tab and a stand-alone HTML page. With some shifting of the API, you can also wrap the same code for mobile and put on the app stores. A user can log in on your mobile app and you can have them logged in on websites and vice-versa (within some limits, but you'll need to explore those).
Games Only?
You are right in that most of the Facebook docs relating to apps refer to games.
Indeed a good place to start is https://developers.facebook.com/docs/games/gamesonfacebook which is where help leads you for Canvas Apps now.
But it doesn't have to be a game - so long as you're using the APIs anything will work. As you mention PHP, have a look at https://developers.facebook.com/docs/php/howto/example_access_token_from_canvas - no mention of a game, but is how you get information from the iFrame in PHP. (There's a lot more reading to do!).
Reading notifications
When clicking on the notification, Facebook will add parameters to the URL. Some of these are determined by the notification (see https://developers.facebook.com/docs/games/services/appnotifications) and others will help you get information about the user (https://developers.facebook.com/docs/reference/login/signed-request, https://developers.facebook.com/docs/php/SignedRequest/5.0.0).
So use this information server-side to work out who the user is and how you want to handle the user. But what experience you want to give the user once you're in the Facebook eco-system is up to you.

Posting on Facebook Page on user's behalf

A team of some friends and I have come up with an app/product idea that we have been working on. I have to be vague on exactly what the details are, but hopefully I can explain it well enough to have the questions we have answered.
First, we have a web server with a database - we have developed all of the code for that in PHP. Each user will have a device which when an action is performed on the device, it sends a message to our server, and the PHP code on our server handles the message and stores the sent data in the appropriate fields in our database.
We want to run this through Facebook - we have an app and a Facebook page created for this. The idea is that when a user performs an action on his or her device and the message is sent to the server, the PHP code will automatically make a post on the Facebook page on the user’s behalf (not on the Page’s behalf).
Between all of us on working on this project, we have spent many days and many hours trying to figure out how to make the automatic post to the page. It’s extremely difficult googling this topic since all of the various examples are using different versions of the Facebook SDK (we are using the latest). There are lots of somewhat similar type questions/examples, but we can't find one that answers specifically what we are asking. In fact, we aren’t even sure that anybody but an ‘admin’ can post on a Facebook page with the new SDK, any longer. I do see this link in the Facebook developer section, https://developers.facebook.com/docs/graph-api/reference/v2.5/page/feed, where it says under the Publishing section:
Permissions
A user access token with publish_actions permission can be used to publish new posts on behalf of that person. Posts will appear in the voice of the user.
So, it sounds as if a user can post to the Facebook page if it is given an access token with publish_actions permission, yet we can’t find any example of code of this actually being done. Could anybody explain how to do the automatic posting to the page on a user’s behalf (hopefully, using PHP, since that is the language we are using on the server side), or at least point us to a good example? We are all experienced developers, but this is the first time any of us has done anything with Facebook development. So we certainly aren’t amateurs, but with Facebook development, we are. We may be overlooking something obvious, but after seeing so many links, my mind is jello.
A summary of our questions:
1. Can it even be done with the latest Facebook SDK that a post can be made to a Facebook Page for our product on the user’s behalf? (to be clear, we are talking about the Facebook Page we created for our app, not a user's page)
2. If so, what specific permissions do we need to give the user, just the publish_actions one? We don’t want to give the user too much permission to be able to screw up our page, of course.
3. Can this be done automatically with PHP from the server?
Any help would be GREATLY appreciated!

Android launching intents for one page on a site

I've built a little mobile web app for the town I live in which aggregates a lot of info and makes it readable. Lately, on my android phone browser, when I go to a certain page it asks me do I want to open it with Browser or MX Android Player. I've looked at the request headers in Chrome and I can't find anything wrong with it. I've had someone test this on an iphone and the issue doesn't happen. Any ideas?
The site in question is http://sligo.me
The page throwing errors is http://sligo.me/Events.
This has nothing to do with your page. It rather has something to do with MX Android Player. Android allows its app to register for URLs to be handled through them. In this way if Chrome is installed on a phone and the user clicks on an URL the system will ask if it should use Chrome or Browser to open the URL. The user can now select a default app or make the choice every time she clicks on a URL.
An app can also register for some URL parts only. A good Twitter app would register for all URLs with the host Twitter and then display the content of that page inside the app.
I guess that MX Android Player registered for some URLs and the http://sligo.me/Events matches that filter. You could experiment a little bit and try to change the URL part that the filter matches. More information about this filtering can be found in the Documentation about Intents and Intentfilters

Post in a facebook app as my page?

I'm a little bit confused right now. But I think I'm making it more complicated than it is actually :) It's about posting out of a Facebook app. I have a Facebook page and I'm about to develop an app which should be integrated in that page. The purpose is to make the page more attractive and memorable. The app is about the content the page contributes. The problem is (I've alredy read some questions about that, but still I don't get it), if I post on a users' wall, I post as the app and not as the page.
It is possible to post on a users' wall after requesting their permission (publish_stream) and also on to post on a page the user administrates (manage_page). Am I right so far? But is there a way to post as my page within my app? Can I post as a one of my app users on a wall with any permission? I thought about if I start to use my app as my page, maybe then I can post as my page?
It may sound a bit awkward, but I hope anyone can help me. At least to tell me that I'm dreaming of something which wouldn't be possible anytime (because of security issues i.e.).
Thanks!
You cannot post as your page, users in your application can post to their walls or your applications page. In fact when building your app, if you are using Facebook as a page and try to refresh your App from your URL you will get errors... if you need help starting your app with the functions i have mentioned, visit this link: http://www.epixseo.com/index.php/facebook-php-3-3-1-and-javascript-sdk-graph-api-tutorial/

Posting to User's walls as application using Facebook PHP API

I've been building a web app that uses facebook integration for easier registration/login and notifications for the users. However, for the notifications I want to be able to post to a users facebook wall when something happens on our site.
Really I see two possible problems with doing this. First being that the user will most likely not be logged in to our website when the notification needs to happen. Second I have not found a way to post to the feed using any identity other than the current logged in user.
So to reiterate exactly what I'm trying to do. When some action takes place on my site involving Bob, I want the websites application to post on Bobs wall notifying him of the action as if the application is one of Bobs friends. From some of the things I've seen while researching this, it seems as if facebook might not treat applications like users and I might have to go through a page to accomplish what I want. But really I'm ok with that.
What you need to do is to ask for the offline_access permission. Then you can store their graph id property after they login/authorize to your site's database. Then you just post to that graph id instead of instead of /me. In your case you would then POST a request to the "$user_graph_id/feed" endpoint with whatever parameters you usually have.

Categories