Can I access to unseen facebook notifications? - facebook

I'm using Facebook Graph Api and FQL.
I would like to access to unseen facebook notifications. Is it possible ?
I have tried to do something like this :
"me/notifications". I can get "unseen_count" in the summary block but how can I have the id of each "unseen" notification in order to find them ?
I know the "unread" but not the "unseen"...
Thansk in advance ;-)

If you use FQL, you can easily get unread notifications:
Try running the following FQL query in your code or test it here:
SELECT app_id, body_html, body_text, href FROM notification WHERE is_unread = 1 AND recipient_id = me()
You will need to ask for the manage_notifications permission for the call to work.

Related

Finding a users friends and determining if they have the app

So, after looking around the two solutions ive seen are:
1) Using the graph API
me/friends?fields=installed
2) Using FQL
SELECT uid FROM user WHERE uid in (SELECT uid1 FROM friend WHERE uid2=me()) AND is_app_user
SELECT uid FROM user WHERE uid in (SELECT uid1 FROM friend WHERE uid2=me()) AND NOT is_app_user
Using the graph API i'm always met with permissions issues and cannot find what permission i need to request in order to access it. And the FQL solution seems to always return false.
So I'm left wondering if theres something simple that im missing in order to get this working,or whether or not these methods are outdated and theres a better way.
Thanks in advance
EDIT 1
I should mention that i am working from a C# api
Using PHP SDK you can get the friendlist by using:
$facebook->api(array('method' => 'friends.getAppUsers'));
As for the permissions: You need to have the email permission to get the friends list with installed flag in it.
I can guess that you are following the normal login flow. like,
1)opening session
2)requesting read permissions (user_info etc.)
just add the "email" permission in read permissions as well and you shall get this installed flag.
3) and then you can use either the graph api or FQL, results should be similar.

FQL - can't get link info from user - 'Request Failed' error

This should be an easy one. All I want it the user's profile url.
I've tried the following FQL:
SELECT profile_url FROM standard_user_info WHERE uid = me()
but get the Request Failed error. I'm using the Graph API Explorer / FQL Query and have the latest Access Token.
Basically I'm looking for the FQL equivalent to this Graph API call:
https://graph.facebook.com/me?fields=link
Thanks for the help
If you read the documentation properly, you'll notice that-
standard_user_info requires the APP_ACCESS_TOKEN, instead of USER_ACCESS_TOKEN. You can get the App Access Token from the Access Token Tool, for the testing.
You can get the information about the authorized app users only.
So, you can test it like this-
SELECT profile_url FROM standard_user_info WHERE uid = USER_ID
Note: Don't use me() (since you are using the app access token now which didn't recognize me()), instead use you ID)

Facebook notification FQL query problems

I want to retrieve the current user's notifications from the past 8 hours. I'm using the Graph API Explorer on FQL mode before I put this into my app. On permissions, I have user_about_me and manage_notifications. The request i'm searching for is this:
SELECT notification_id FROM notification WHERE recipient_id={0}
But it returns:
{
"error": "Request failed"
}
What am I doing wrong?
The error Request failed
generally occurs when the your request in not correct.
If you read the documentation properly, this API is used to fetch -
The current user's notifications
So, only valid recipient_id could be the current user's id or me(); not his friends or any other user.
If you have tried the current user's id to the recipient_id, that means the id you've provided with {0} is not correct (some syntactical error).
So, instead you could simply write recipient_id = me()

How mark a Facebook notification as read via Facebook API?

I have managed to get a list of new Facebook Notifications but can't seem to find a way of marking them as read?
I am using FQL with the PHP SDK.
Please can someone point me to some documentation with examples.
To mark a notification as read, POST to
graph.facebook.com/NOTIFICATION_ID
with param "unread"=0.
If you've received the notification object via Grapth API, NOTIFICATION_ID equals the id of the notification object.
If you've received the notification object via FQL, you'll have to build NOTIFICATION_ID as follows:
"Notif_" + userId + "_" + notification_id.
For example if current userId is 123 and notification_id from FQL is 456, NOTIFICATION_ID should be:
notif_123_456
and the POST becomes:
graph.facebook.com/notif_123_456
with parameter unread=0
You'll need 'manage_notifications' permission.
To read notifications, you will need to get manage_notifications permission from the user. (Presuming you already have that is you can getList).
To mark a notification as read you need to use:
notifications.markRead
You can find information on this page.
http://developers.facebook.com/docs/reference/rest/notifications.markRead/
You cannot use straight FQL to mark a notification as read and you can only mark notifications that have been created (as I am led to believe) during the current user session.

Get Facebook status and replies for those status

I am trying to get facebook status and replies for those status, so what I didn't find anything other than Status messages: [a link] https://graph.facebook.com/367501354973 (A status message from Bret). Looks like this require userid but how can I get user id's of my friends. If I get my friends can I get the status of friends of my friends. I have been searching every possible place to find an answer on getting facebook status along with the replies but so for no luck. It would be great if there is a webcrawler for something like this.
Check this
http://developers.facebook.com/docs/reference/api/status/
You can also use below facebook Graph API Explorer tool to test
http://developers.facebook.com/tools/explorer/?method=GET&path=580490479
You can get your friend's ID by below
https://graph.facebook.com/me/friends?access_token=
You can get updated of Your friends by
https://graph.facebook.com/580490479/feed
and for Posting check below
http://developers.facebook.com/docs/reference/api/post/
--- Samir