Facebook connect approbation - facebook

Context: For a Hackathon I building an app (web based - Ruby on Rails) that matches people based on their commun interests. For that I want to use Facebook connect and instantaneously get a person's likes so I can match him/her with someone with similar interests.
The problem: But apparently I can't access someone's likes through Facebook connect unless my app has been approved by Facebook. But without this login there is no app (and I can't wait 3-7 business days to have a working app).
Is there a way I can get my app to work (even if it's only with a set of approved users/testers)? Or do I have to come up with a an alternative page where my users will have to manually enter their interests?

No, there's no shortcut for the Login Review. What you can do is adding specific users (via your app's dashboard) you want to test your functionality with as admins/developers/testers of the specific app.
This will allow them to be able to grant your app extended permissions as user_likes without Login Review.
Also, I think Facebook already provides an endpoint for your use case:
/{user-id}?fields=context{mutual_likes}
which will produce something like
{
"context": {
"mutual_likes": {
"data": [
{
"category": "Media/news/publishing",
"name": "Mashable",
"id": "18807449704"
},
{
"category": "Food/beverages",
"name": "Coca-Cola",
"id": "40796308305"
}
],
"paging": {
"cursors": {
"before": "MTg4MDc0NDk3MDQ=",
"after": "NDA3OTYzMDgzMDU="
}
},
"summary": {
"total_count": 2
}
}
},
"id": "123456789"
}
See
https://developers.facebook.com/docs/graph-api/reference/v2.0/user.context/mutual_likes
https://developers.facebook.com/docs/graph-api/reference/v2.0/page.context/friends_who_like
https://developers.facebook.com/docs/facebook-login/review/how-to-submit#testpermissions
https://developers.facebook.com/apps/{your_app_id}/roles/

Related

Facebook friends returning empty data

I implemented possibility to search friends from facebook who logged into my app using facebook.
It was working, I was getting one facebook id as I supposed, but now I trying to work about functionalities around this and I am getting empty data. I even check with other friend but still data for friends is empty. Something changed in last month?
{
"id": "49....38",
"name": "Karol Wiśniewski",
"friends": {
"data": [
],
"summary": {
"total_count": 359
}
}
}
EDIT: Yes, I have people who logged in using facebook to my app in friends

Does Facebook have a webhook that an app can subscribe to to detect when a Facebook event is added to a page?

Does Facebook have a webhook that an app can subscribe to to detect when a Facebook event is added to a page? Or do apps that are interested in this information just have to repeatedly poll /[page-id]?fields=events ?
For example if you have a page that creates some event, as long as you subscribe to feeds, Facebook Realtime API will send you json payload that looks similar to this:
{
"entry": [
{
"changes": [
{
"field": "feed",
"value": {
"story": "Some page added an event.",
"item": "event",
"event_id": "2277580782468248",
"post_id": "1442694315844896_2277580782468248",
"verb": "add",
"created_time": 1511651353,
"message": "test event"
}
}
],
"id": "1442694315844895",
"time": 1511651355
}
],
"object": "page"
}
Then you probably would like to pull the Graph API for additional informations about your event_id
The product you are trying to find is Facebook Webhooks https://developers.facebook.com/docs/graph-api/webhooks/. It allows you to subscribe to changes on the Facebook page and get alert only when change occures. You don't need to have regular calls with Graph API to see whether there are changes.
First you need to create facebook app, and then to add webhooks on that Facebook app. Next step is to subscribe that webhook to page you want and select "feed" as subscription. You will be informed about any change on your page.

Can't get categories on Likes on new FB graph API (2.5)

I am using this URL to access facebook likes off of an authorized and logged in user:
https://graph.facebook.com/v2.3/me/likes?access_token=accessToken
it returns this
"data": [
{
"name": "Page Name",
"category": "Category name",
"id": "12345678",
"created_time": "2012-03-26T08:02:01+0000"
},
However on my new app which uses API 2.5
https://graph.facebook.com/v2.5/me/likes?access_token=accessToken
it returns this
"data": [
{
"name": "Page Name",
"id": "12345678",
"created_time": "2012-03-26T08:02:01+0000"
},
Which is minus the category name.
I have my new app registered in FB and it will not allow me change API from 2.5, and even on my new app if I use the 2.3 URL it will still not display categories.
Does anyone know what extra calls I need to make to get categories or why they have disapeared in newer versions of the API, I can't find anything on google or on FB's doco's
It´s called "Declarative Fields", check out the changelog for v2.4: https://developers.facebook.com/docs/apps/changelog#v2_4
That´s what you need to change:
/me/likes?fields=name,category&access_token=accessToken

How to get a number of friends that like particular page in Facebook [duplicate]

This question already has answers here:
Facebook API: Get fans of / people who like a page
(8 answers)
Closed 8 years ago.
I would like to build an app that tells user how many of his friends like a particular facebook page.
Let's say the name of page is Machester United. And I have 20 friends who like that page.
How can I do that? Should I use facebook graphAPI? Are there any other ways>
I am very new to this. Can you give me some key concepts/things that I should look into?
I think the Social Context API might be the right thing for you, if you're mainly interested in the number of friends which like a certain Facebook Page.
See https://developers.facebook.com/docs/facebook-login/social-context/v2.0
Use
GET /cocacola?fields=context.fields(friends_who_like)
to see which/how many of your friends like the CocaCola Page.
The result will look like
{
"context": {
"friends_who_like": {
"data": [
{
"id": "123456789",
"name": "Firstname Lastname"
}
],
"paging": {
"cursors": {
"before": "ODQ5MDkwMjQ2",
"after": "ODQ5MDkwMjQ2"
}
},
"summary": {
"social_sentence": "4 of your friends like this.",
"total_count": 4
}
}
},
"id": "40796308305"
}
The context.summary.total_count field will contain the number of friends which like the Page.
Try it here: https://developers.facebook.com/tools/explorer?method=GET&path=cocacola%3Ffields%3Dcontext.fields(friends_who_like)&version=v2.0
Keep in mind that
In order for a person to be identifiably returned in a context edge, they must have:
Logged into the app.
Granted the user_friends permission.
Granted the appropriate content permission in order to see the action. For example, to appear in the friends_who_like context edge, each friend has to have granted the app the user_likes permission.

Scope of Facebook API

I am trying to learn and create a Facebook API on the go. However, I haven't found any page on the developer pages that specifies the scope of the Facebook API in great detail. I understand public information can be accessed using Graph API. But at the same time understand that further access is possible, not sure how much though.
Is there anyway to access the 'Edit news feed options' of a user that authorizes an application?
I don't really understand what you mean by "scope", but the Graph API is not more than a series of URLs to contact the facebook servers with queries and obtain answers in form of JSON objects.
You can start learning by looking at the reference for the API here:
http://developers.facebook.com/docs/reference/api/
There are unofficial APIs for every language you can imagine, for example java: http://code.google.com/p/facebook-java-api/ , c#: http://facebooksdk.codeplex.com/ , etc.
To read the news feed, you can access it by:
https://graph.facebook.com/me/home?access_token=TOKEN (where TOKEN is the access token)
Fb will respond with a JSON object similar to the one pasted below.
{
"data": [
{
"id": "11111_1111111111,
"from": {
"name": "Name",
"id": "11111111"
},
"message": "SOME_MESSAGE",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/111111/posts/11111"
},
{
"name": "Like",
"link": "http://www.facebook.com/11111/posts/11111"
}
],
"type": "status",
"created_time": "2011-04-20T20:19:04+0000",
"updated_time": "2011-04-20T20:19:04+0000"
},
etc etc etc
],
"paging": {
"previous": "https://graph.facebook.com/me/home?access_token=TOKEN",
"next": "https://graph.facebook.com/me/home?access_token=TOKEN"
}
}
Having that, you can use the ID for the person or the message to perform new queries, as explained in the FB API page:
All of the objects in the Facebook
social graph are connected to each
other via relationships. Bret Taylor
is a fan of the Coca-Cola page, and
Bret Taylor and Arjun Banker are
friends. We call those relationships
connections in our API. You can
examine the connections between
objects using the URL structure
https://graph.facebook.com/ID/CONNECTION_TYPE.
The connections supported for people
and pages include:
Almost every information on FB is accessible through the Graph API, provided the user authorized the app with the rigth permissions:
http://developers.facebook.com/docs/authentication/permissions/