Shazy792
Shazy792

Reputation: 1

Marking facebook notificatios as read Graph API

Hi Everybody, I am using
https://graph.facebook.com/USER_ID/notifications?include_read=1&access_token=ACCESS_TOKEN to get notifications from facebook in my vb.net application but I cannot mark the notification as read I have tried https://graph.facebook.com/NOTIF_ID?unread=falsebut it does not seem to work. Can anybody help me to mark the notification as read? Please note in the code

USER_ID = xxxxxxxxxxxx
ACCESS_TOKEN = xxxxx.....xxxx(quite lengthy actually)
NOTIF_ID = notif_xxxxxxx_yyyyyyyy

Thankyou :)

Upvotes: 0

Views: 588

Answers (1)

Ajeet
Ajeet

Reputation: 892

The URL your are using for marking the notification read is completely correct. I am using it it for marking notification read in one of my applications. There must be some problem with the post request you are making.

Here is how i am marking the notification read (in C#/XAML). VB.NET implemention shouldn't be far from it.

I fetch the notificaiton data including read like you already do and saves them in a collection/List. Then to mark a single item read use the following code :

string notif_id = item.Id; // My notification obj

string url = "https://graph.facebook.com/" + notif_id + "?unread=false";

FacebookClient fb = new FacebookClient(App.AccessToken);

IDictionary para = new Dictionary();

dynamic result = await fb.PostTaskAsync(url, para);

opResult = (bool)result; // If its true means notification has been successfully marked read

If you want to mark them in a single batch, then just use a forearch and above code inside it like :

foreach(Notification item in NotificationsCollection) {

// insert above code lines here

}

Hope this helps. :)

Upvotes: 1

Related Questions