meps
meps

Reputation: 579

How to use new client side Facebook notifications API

Official documentation https://developers.facebook.com/docs/app_notifications/ says:

  1. "Apps can send notifications to any existing user that has authorized the app. No special or extended permission is to required."

  2. "All notifications from an app are treated the same way, independent of how it was sent - via this API or as a user-to-user request."

Server side API works fine, but I've decided to call notification API directly from flash client. I've requested {recipient_userid}/notifications with all necessary stuff like client token etc.

First time I've received error 200. After applying manage_notifications permissions for application I've received new type of error 606 ("You do not have permission to fetch notifications for this user").

My question is it possible to send notifications through client side request to Graph API? Is additional permissions needed?

Upvotes: 3

Views: 1912

Answers (1)

Guy Tomer
Guy Tomer

Reputation: 66

As you can see from the fb docs:

Note: Only apps on Facebook.com can use the Notifications API. Also these notifications are only surfaced on >desktop version of Facebook.com.

That means that when posting a notification, you must use an application access token - not the usual user access token.

You must first get the application access token:

GET https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials

Then use this access token when posting to the graph api.

Upvotes: 3

Related Questions