koala icon indicating copy to clipboard operation
koala copied to clipboard

Missing 'object' field in Notifications

Open ianrenton opened this issue 11 years ago • 2 comments

When retrieving a user's Notifications feed, each notification should contain a field called 'object' which contains the object (e.g. status update or photo) that the notification is for (see Facebook docs.)

As of a few weeks ago, I no longer see this field when I access the API using koala. At the time the change happened, I didn't change my code or the version of koala I was using (1.6.0) so I assume this change was caused by Facebook. I have since updated to the latest koala but the problem remains.

Is this something that can be fixed by koala or has Facebook stopped returning this information?

Thanks

ianrenton avatar May 07 '14 06:05 ianrenton

I tried both /v1.0/me/notifications?include_read=true and /v2.0/me/notifications?include_read=true endpoints to see if it's a version specific problem and I reproduced it in both environments. To make it clear that it has nothing to do with any SDK or client module, I used Graph Explorer.

Some returned data contained object field and some didn't so I looked up the application.name field only to find no connection. Some notification with application.name of "Likes" have object field while some don't. There is no other field that we can refer to to distinguish notification types. I gave up looking at returned value.

I, however, found a post that relates to this problem. You might want to report a bug or post in a larger developer community. I think the document lacks information about what can be given in object field...

oklahomer avatar May 07 '14 13:05 oklahomer

For anyone else with this problem, I've discovered that (completely undocumented of course) requesting an individual notification with get_object returns the notification's object field a lot more reliably than when getting the entire notification feed with get_connections.

As an ugly workaround, I am currently requesting each notification individually and fetching its object field like this:

notifications.each do |item|
  if (!item['object'])
    newCopy = facebookClient.get_object(item['id'])
    if newCopy['object']
      item['object'] = newCopy['object']
    end
  end
end

This works very reliably, though my program is now making a lot more calls to the Facebook API.

ianrenton avatar Jun 19 '14 20:06 ianrenton