How to use complex search phrase in Facebook Graph API? - facebook-graph-api

The Facebook site allows to search for phrases like:
Pages liked by people who are older than 50 and live in Munich,
Germany.
How can I do that with the Graph API?
If this is not possible, do you know a workaround to do such searches automatically?

You can not do this at all.
The reason: Privacy.
You can not search all users of Facebook for demographic data this detailed.
In order to get what a user like you'll need the user to authorize your app to use "user_likes", which requires review. Source: Scroll down to "user_likes" section
In order to get anything other then under 18, or under/over 21 you'll need "user_birthday", which requires review. Source: Scroll down to "Guidelines" on load then "ctrl+F" for "user_birthday"
You can use "age_range" from public profile, doesn't require review, but this will only be for users that have authorized your app. Source: Age Range.
In order to get a user location you'll need the user to authorize your app to use "user_location", which requires review. Source: ctrl+F type "user_loction"
You can use "locale" from public profile, doesn't require review, but this will only be for users that have authorized your app, and it will only show what language they use FB in. Source: Scroll down to "gender & locale" under "Public Profile"
All of what you want to do requires a Facebook review I doubt it will be approved. Next even if it did only those users that have installed/authorized your app will be available to your app. You absolutely can not open search user data like that with out the users permission.

Related

Using facebook graph api to read photo tags

I am building a website using React and Redux to search facebook photos through tags like my Friends name or by location. User needs to login with facebook so that the application can read its pictures. A user simply puts in the search filters like Tagged users or the location of the picture and my app will show results based on the filters. This will help to find old photos with friends which sometimes get lost on social media due to a large number of photos present(Uploaded or Tagged)
I am trying to fetch mutual photos of me and my friends using my access token and trying to read the tags present in the photos through API but the Response contains only my name in the tags and not other people who are tagged in that photo.
Is there any way to fetch the users who are tagged on a photo uploaded? Any help is appreciated.
Graph api link
Access to any data involving your friends is only possible if those friends specifically authorized your App too. You cannot even get an ID of a friend if he did not authorize your App.
Yes, in order to access involving your friend to authorize your app. But from the details i can see that,
"A user access token may read a photo that the current user is tagged in if they have granted the user_photos or user_posts permission. However, in some cases the photo's owner's privacy settings may not allow your application to access it."
Note: Just need to verify users privacy setting once again.

Access public data of other users using Instagram/Facebook API

I would like to access other users public data to show in my website when they configure the page by their username/id.
It means I will create an app on FB/Instagram side and with the help of this app's access token I would like to fetch public data of other user.
Is this scenario valid now? Earlier it was possible but I am not sure now with changes in policies. Even the documents are not clear enough which can say it's possible or not?
Has anyone tried this out recently?
Users: Only data of users who specifically authorized your App is available, depending on the authorized permissions. It does not matter if data of user profiles is public or not, you have to get permission from each user separately.
Pages: If you want to get data of pages you don´t own, you have to go through a review process with your App to get access to "Page Public Content": https://developers.facebook.com/docs/apps/review/feature/#reference-PAGES_ACCESS
That´s for Facebook, about Instagram you can just hit the docs (as well): https://developers.facebook.com/docs/instagram-api/business-discovery
My number one recommendation, in this case, is Facebook API or Instagram API from Data365. I may be considered biased since it is the tool I work for, but it is really a reliable tool you can get public profile data by users ID or username.
Of course, you can use the official Facebook/Instagram APIs for searching all public objects (post, user, page, event, group, place, check-in). But note, the official API has a number of restrictions. Andyrandy has already described them in his answer. Compared with official APIs, we do not have such restrictions.
Besides, our APIs provide such unique features as gender and age recognition (via face photos) along with identification of post reactions that give a competitive advantage in obtained analytics. Data365 APIs also enable developers to create monitoring tasks for a one-time or auto data update. And above all, we do not break the law but only provide web scraping within the legal framework.

How to allow user to access their FB album and share an image from their album

I was recently asked if it were possible to allow a visitor to upload their own images from their facebook album to our site.
So the visitor would click "Upload from FB" they click it and they have to give permission for our site to access their account. They would then choose an image from their albums and essentially upload that image into our site.
Can something like this even be done?
I know I can access albums using the graph api. Are there any legal or privacy issues in doing so?
1 - From Facebook developers policy section II, 2.
You may cache data you receive through use of the Facebook API in
order to improve your application’s user experience, but you should
try to keep the data up to date. This permission does not give you any
rights to such data.
You should read this document as it provides all the legal answers regarding the platform.
2 - On the technical side of the question, yes it can be done - there are many facebook application that lets you browse your photos and add effect to it such as Aviary Editor
Take a look at the code here: https://github.com/bearlake/putafilteronit/blob/master/index.php
The code is pretty messy as I never cleaned it up but it shows how I pulled in FB albums and allowed a user to choose a picture.

Can I use Pages to authorize on my website in the same way Facebook Connect does?

Is there any way to authorize user (acting as a Page or Page administrator) in the same like FB Conect does but using Page data?
E.g. I would like a company, say local barber, authorize in my system as a certain Page (can be indirect, i.e. through a private account but I would like to know if this user is a page administrator). The purpose of this is to link an account on my website with a certain business that has representation on Facebook.
Well, you could ask the user for manage_pages permission and look if the page you’re interested in is amongst them, but since that’ll give your app also their page access tokens, I doubt they’ll grant you that.
Less intrusive and much simpler would be to have them install your app on their page as a page tab, and then look into the signed_request parameter once their using your app - it has a boolean flag for wether the user is admin or not. After that they can remove your app again.

How can I allow my users, who create pages on my website, to communicate back to those people who click the Facebook "Like" button on their pages?

OK, apologies for the verbose title. Let me give the background in a bit more detail.
My website allows my registered users to create new pages, each of which has its own unique URL. Each page has a Facebook "Like" button on it. I've already implemented Facebook Open Graph API meta tags so that the pages are proper open graph objects, and when some other visiting Facebook user "likes" the registered user's page, a post appears on that Facebook user's wall saying they have liked the page. The Facebook Like widget also displays the number of "likes" that page has received as normal. So far, so good.
What I want to do is allow my registered users to be able to communicate back to the Facebook users who have liked their page. The community of "likers" for a page is a potentially valuable social media resource to the registered user, if only they could communicate back.
I am aware of the "admin page" link you get beside the Like button, which can be used to post to these people, but that is not an option for my registered users as they have no privileges in relation to the Like button.
What I want to do, if possible, is setup a form to capture the registered user's message back to the Facebook users, and then my website sends the message on their behalf, without having to ask for any extra privileges from the Facebook users.
The following Facebook documentation pages seem to say this is possible, but having followed the Open Graph API documentation, I can't get it to work as described - http://developers.facebook.com/blog/post/465/ and http://developers.facebook.com/docs/reference/api/ ("Publishing" subsection). I can get the access token correctly in the first request, and plug that into the second request to do the post, but that doesn't seem to do anything and doesn't return any error.
Since it doesn't work for me, I'm wondering if this is possible as described, or do I need to get some sort of extra permission to do this? I've seen reference to offline_access permission but as I'm new to this stuff I am not sure how it would fit in. If I have to get the Facebook users to grant permissions, this is not going to work as envisaged.
Any thoughts would be most helpful.
The short answer: No, You will never been able to post on someones wall as another user.
The long answer:
You could try to ask for offline access but then you are asking the user to hand over all their facebook data and give you access todo whatever you like their accound, so that is not likely to happend.
The next problem is that they have to be friends to be able to post on each others walls.
Thats why Pages was implemented, so that organisations could announce/talk with the people interested.
However if you have created the like button correctly and give the pages correct meta data, you are able to post to user who have liked it.
Scroll down to Publishing:
http://developers.facebook.com/docs/opengraph/
Just add a form for your user and let your system publish to the correct page, you probably will need a offline token from your own account or similar to use on the server.
Another more complex way could be to generate a facebook page for each page you have on your server.
When the user creates a page on your system a page is created on facebook but as your app as admin.
And when another user likes the page they like the facebook page, hence you have the possibility to post in that page and speak to the user who liked it. (whooa thats a mouthfull).