Mark notification as read with Facebook API in iOS - facebook-graph-api

I have referenced a few problems about this issue on StackOverflow, but nothing seems to work.
Code:
NSMutableDictionary *dc = [NSMutableDictionary dictionaryWithObjectsAndKeys:#"0", #"unread", nil];
[facebook requestWithGraphPath:#"21306691" andParams:dc andHttpMethod:#"POST" andDelegate:self];
21306691 is the notification_id. I am sure that I have manage_notifications permission.
Please help me, thanks a lot!

notif_recipient_id_notificationid
Where notif is a key word,
recipient_id is id of logged in facebook user
notificationid is the id of notification (which you got).
Use the above pattern.

I think your Notification ID is wrong! I get a format like this: notif_524065381_15010202 for Notification IDs!
Always check with Graph API Explorer to see if your Facebook request works, if yes, then look at your code!

Related

Facebook Graph API, Why "can_reply_privately" is false on some user's comment?

On Facebook Graph API, why "can_reply_privately" is false on some user's comment (even i don't reply to my own comment). So it prevent us to send a private reply to that user.
It return error: "(#10903) This user cant reply to this activity".
If any suggestion to fix this activity is really appreciated!
Thank you.

Facebook subscription API

When making a POST to subscribe to Facebook, Facebook issues a GET with the callback URL with the following query parameter:
hub.mode
hub.challenge
hub.verify_token
Once we verify the mode and the token and return the hub.challenge does Facebook respond with a status message? It is not clear in the docs...
You are correct it is not clear in the documentation. What happens on your end when you subscribe? If you get something viable, then click the Report Documentation Bug at the bottom of https://developers.facebook.com/docs/reference/api/realtime/ and log the issue.

Fetching one's old Facebook status messages

I want to fetch one's old Facebook status. I have written the code for the same but it looks like it is not working for me. The steps that I have followed are as follows:
First I use the below API to seek the code from Facebook (by prompting user to log in to the Facebook page)
https://www.facebook.com/dialog/oauth?client_id=xxyy&redirect_uri=http://xxyy/home.aspx&scope=publish_stream,read_stream";
Then I seek the AccessToken by passing the code obtained in the above point to the below api as:
https://graph.facebook.com/oauth/access_token?client_id=xxy&redirect_uri=http://xxyy/home.aspx&client_secret=xxyy&code=zzz"
Now there is a problem. I am not able to understand which API I need to use to fetch the old status of the logged in user. I guess I have the access token which is the key to fetching the info. But I am not able to find the relevant API.
I would recommend that you use FQL.
//PHP example:
$fql_query_url = 'https://graph.facebook.com/'
. '/fql?q=fql?q=SELECT status_id, message FROM status WHERE uid=me()'
. '&' . $access_token;
$fql_query_result = file_get_contents($fql_query_url);
The graph API and "post" feed is what you need. I don't usually do this but I need my old statuses!
Following code works for me for fetching Facebook Conversation:
String s = facebook.request("me/inbox");
System.out.println("Message...."+s);

How to post a message on wall of facebook using a graph api

How to post a message on the wall of facebook or add comment to the thread using a graph api.I want a url of that.
like for adding a message to wall
https://graph.facebook.com/profile_id/feed?access_token=generated token&message=hi
But it not working ,it not get added to my wall.
You need to add &method=post to your request URL. Also, you must have the `publish_stream extended permission for your application.
https://graph.facebook.com/user_id/feed?method=post&message=hi&access_token=generatedtoken.. will work
instead of profile id give the user id
Hope this will work

How to handle the scenario "access_token changes when user changes facebook password"

I am able to see from the following link that, if password change, access_token will get invalidated.
http://developers.facebook.com/docs/authentication/
So, how to identify when user change his/her password.
I did not see anything about this in the graph api documentation.
Please help me regarding this.
Thanks,
Gopal.
When access_token is invalidated due to password change, you can no longer make Graph API calls, i.e. Graph API returns an error. You can recognize this error and set a flag in user profile which triggers a notification "Hi Gopal, you have to reconnect your account with FB. To do so, click [here]", where [here] points to the regular FB oauth url (i.e. https://graph.facebook.com/oauth/authorize).
EDIT 14/05/2011: Facebook just released blog entry on this topic: http://developers.facebook.com/blog/post/500