Reputation: 21
At the left column on facebook's home page, a notification from Facebook applications appears with a gray character, for example, "APPLICATION NAME [1]".
For example, Badoo app displays this type of notification when a friend has answered my question.
How do I display this notification for my own application?
Upvotes: 2
Views: 2181
Reputation: 56948
Your English is great, hkweb. To send the user a "Notification", you must send a POST request to the user's /apprequests connection. You'll need a valid access_token for the user and this user must have "installed" your application before you can send them notifications like this OR use the Requests Dialog. Afterwards, it's as simple as sending a POST to:
https://graph.facebook.com/{USER_ID}/apprequests?access_token={ACCESS_TOKEN}
or
https://graph.facebook.com/me/apprequests?access_token={ACCESS_TOKEN}
The only required parameter to be sent is "message", but you can also send a JSON-encoded dictionary of parameters in the "data" parameter. I recommend you play with the API Graph Explorer. There you can send yourself apprequests with a POST, check your pending ones with a GET and clear pending requests with a DELETE request to
https://graph.facebook.com/{ID_OF_REQUEST_OBJECT}
If you're developing an application on Facebook (like a canvas app), you can make use of the Requests Dialog which makes sending the POST very easy and gives you a friend selector as well.
You can also get the user's pending apprequests by sending a GET request to the same object.
Upvotes: 3