How to get contact list of a facebook user in grails using spring-security-rest:1.4.0.RC5 - facebook

I am using spring-security-rest:1.4.0.RC5 api to login with facebook, twitter, linkedin and googleplus in my grails application. I am able to fetch user details like first name, email etc. But I am not getting the contact list of user. How can I get the contact list of the user.
Thanks in advance.

As of version 2 of the graph API you can no longer get the complete list of a user's friends. Instead, you only see the friends who have also authorized your application. This is by design as Facebook does not want developers to be taking list of friends and taking their info.
If you registered for your application key before v2 was released then you can continue to use the old API which allows for this functionality. However, all apps will be automatically upgraded on April 30th, 2015 so you won't be able to use it for long.

Related

Facebook Messenger Platform: how to get user specific information?

I'm trying the recent released Facebook Messenger Platform and so far so good. Everything worked well and I was able to create a echo bot.
But I'm wondering how I could identify this user that started chatting in my page. For example, when a user started chatting I get a PID user (page specific user id).
Making the follow request to Facebook Graph API:
GET https://graph.facebook.com/v2.6/{PAGE_SPECIFIC_USER_ID}
I discovered that I can just ask for the following fields: first_name,last_name and profile_pic.
So my question is, how could I discover if this user is a current customer of my business page? Is there another way of querying more information (like e-mail and real facebook user id)?
Facebook has updated the messenger platform API (2016-07-01) and introduced a new feature called Account Linking. This can be used to identify a user who has created an account on your website via Facebook Login and you can link the two accounts. Facebook login has its own set of permissions which can be used to get a lot more information via Facebook graph API. You can find the complete list here.
Currently, there's no way to do this. The best way would be to prompt the user to enter their information in chat or give them a link to a mobile login page or some other way of linking their account to the chat.
Messenger Platform 2.0 introduce "ID Matching API" ,that will solve the problem.
https://developers.facebook.com/docs/messenger-platform/connecting-accounts
you can retreive a user information like below using fbmq library https://github.com/conbus/fbmq
# this method will occur when a message received from user
#page.handle_message
def message_handler(event):
user_profile = page.get_user_profile(event.sender_id)
print(user_profile) #first_name, last_name, profile_pic, gender ...

How do I get a facebook user's most recent messages with another user?

I'm working on a web application in which I show the last time the current user (who authenticates with FB and supplies all relevant permissions) user interacted with another user. Example, my ID is 1526632 and would like to find the date of the last message sent between me and another facebook user (either by username, or id #).
I've been reading through their API and it seems this permission existed in version 2.4 of the Chat API but was since deprecated. Is there a new way for developers to get this information somehow?
My guess is this is not possible via the graph API. Assuming this is true, does facebook have unpublished IMAP access to a user's inbox? Or any other creative ways I can do this?
The Chat API is gone, as you have found out already. There is no replacement, what you want to achieve is not possible in any way. The user inbox is off limits now, i´m afraid.

Facebook Graph API: how to get online friends / or active last X minutes

Past & Now
A few years back, Facebook supports FQL in v2.0 to retrieve online friends of an user ( Facebook : Get List of Online Friends Using Graph api )
However this FQL is removed from v2.3, and what's worse is Facebook completely removed Chat API (XMPP) from April 2015.
Goal
Is it still possible to generate a list of Facebook friends and their last active time / currently online using Graph API / or any other method? (basically the same as chat window on Facebook desktop)
This would be useful:
when a user wants to see who's online but don't want to let their friends know they're online atm
or for a simple widget on phone screen, where user can have a quick look at who're online without the need of Facebook login (the widget gets data from 3rd party server which uses API / or some other method to provide that list)
Thanks alot for your input
No, it is not possible - because as you found out already, Facebook removed the required permission/endpoint. The only way would be implement your own routine for this. For example, by storing the timestamp of visiting users. Whenever a friend of that user visits your App too, you can show those to him. Of course it only works for users who authorized your App and youi can only detect if users are online/active in YOUR App, not on Facebook.

How app_scoped_ids will be used on custom audience after May 1st?

On custom audience, there is the possibility to upload a Facebook ID list for creating an audience... After the Graph API v2.0 migration, when we won't have access to Facebook ID anymore, how can i upload the user id list? Can i use a app_scoped_id based list?
If someone publishes something on my fanpage, and i get his post using Graph API, will i be able to use his id on custom audience? The official documentation don't make itself clear when explaining about the "expiring process" of a app_scoped_id. As far as i understood, when someone authorizes an application, his app_scoped_id will be "permanent", but if there is no user interaction/authorization with my application, the app_scoped_id CAN expire in 24 hours... is that right? If so, how can i use a list of ids on custom audience if they expires?
Thank you!
UPDATE
From https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids:
For users who have not logged into your app, the user ID may change depending on the version of the API that you call. In v1.0 of the API users who have not logged into your app will be referred to by their original Facebook user ID, whereas in v2.0 they will be referred to by an app-scoped ID.
We've added new API endpoints that allow you to tag and invite friends who don't use your app. These APIs return tokens which may be used to generate custom interfaces for tagging and invitations. Those tokens aren't meant to be cachable and we make no guarantees that they will be stable beyond 24 hours from the time the API response containing them was received. They aren't the same as either the IDs used on data for people not logged into your app nor the same as the app-scoped IDs.
You are confusing the app-scoped IDs with temporarily generated IDs. App-scoped IDs will not change over time. Temporarily generated IDs are meant to help with inviting and tagging friends who have not authorized an application and as such they will not remain the same over time.

Find locations of checkins from foursquare friends using v2 API?

How is it possible to get the locations of a user's friends nearby(within X km) with v2 or real-time user push of FourSquare API please?
And can those friends be the same friends as the ones from facebook account automatically added (for those fb friends of the user that also login with their fb account to 4sqr too), or, when a user joins 4sqr via fb can they register to an app using 4sqr API and then have that app specify somehow what his friends could be and make them all part of the same group whose last checkins could be searched?
In other words, I would like to list all nearby 4sqr friends that are in the same group (list?) along with a last time stamp of their checkins. Can this be done and how please? Which APIs should I use along with OAuth or something?
Based on the API docs (https://developer.foursquare.com/docs/), it doesn't seem that you'll be able to get the information you are looking for.
It looks like you'll be able to get real time pings when a user that is using your app checks in somewhere. But you can't get just any foursquare user's real time checkin events.
Unfortunately
I guess this is possible, at least until the Graph API v1.0 is still working (until April 30th, 2015), because then all the friends_* permissions will be removed. Have a look at the answer at
Facebook Open Graph API - action-type & object-type of another application (foursquare)
You need to request the user_actions:playfoursquare and friends_actions:playfoursquare permissions first (Reference).
Then, you should be able to request the checkins via
/me/playfoursquare:checkin_to
or
/me/friends/playfoursquare:checkin_to