29

I asked this on the Facebook Developers Forum with no responses.. How do I send notifications to users so they show up in the Notifications globe icon tab on the top left of a user's Facebook page? Some applications I use have their notifications show up there, but I don't see how that mechanism works in Facebook's API docs. Neither are there any permissions which seem to be required to send users notifications.

at.
  • 50,922
  • 104
  • 292
  • 461

5 Answers5

38

I know this is an old post - but someone might stumble on it as I did, and find it useful: The notifications area in FB is updated by sending Requests which can be sent by using FB dialogs. The JS SDK provides the FB.ui() method to show dialogs for posting to stream, or sending a request.

More Info on FB: http://developers.facebook.com/docs/reference/dialogs/requests/

http://developers.facebook.com/docs/reference/javascript/FB.ui/

oneamongu
  • 399
  • 3
  • 4
  • Thanks. I tried the sample on the facebook page and request succeeds but where should I see the request on facebook page ? – cagatay May 20 '12 at 04:16
  • As a comment, and I guess it's in the docs as well, only apps on Facebook (apps.facebook.com/{appname}) can sent App Request, not Page Tab Apps. – curly_brackets Jun 15 '12 at 20:33
  • Might also be helpful to check out A2U Notifications.. https://developers.facebook.com/docs/games/services/appnotifications – Femi Aug 31 '17 at 14:19
16

Apparently facebook activate again the possibility to send notifications :

https://developers.facebook.com/docs/app_notifications/#ux

POST /{recipient_userid}/notifications?access_token= … &template= … &href= …
R.Kueny
  • 320
  • 2
  • 10
  • 1
    Ahh, I thought this was using the user's access token. But instead, this is a seperate "app access token" :) – Gaui Nov 09 '12 at 14:28
  • 2
    Where do we POST to? I have the access token, recipient id, template and href but not the beginning of the URL to cURL. I am trying to do this from an external script outside of Facebook BTW – rmccallum Nov 29 '12 at 09:05
  • how to do this js? I mean what should be the format of post request in js/jquery? – scottydelta Jul 03 '13 at 06:03
  • Although for a different problem but [I wrote an answer on how to use it](https://stackoverflow.com/a/48831913/1494454). – totymedli Feb 16 '18 at 17:41
4

You need to post it to -

https://graph.facebook.com/

for example - https://graph.facebook.com/{recipient_userid}/notifications? access_token= ... href= ... & template= ...

DataB
  • 161
  • 1
  • 2
  • 8
  • Have you been using the new notifications API? I know it's in beta but it seems to be lacking in documentation. I need to implement something pretty quickly and could use an example that's in context. Anybody have a link to a working example/tutorial ? – Ryan Ore Jan 08 '13 at 14:57
  • Check this out... a topic about posting a Facebook notification with Drupal's drupal_http_build_query() , but you should get the idea - http://stackoverflow.com/questions/13916287/how-to-construct-an-https-post-request-with-drupal-http-request – DataB Jan 09 '13 at 20:54
  • Do you POST an empty body to ` https://graph.facebook.com/{recipient_userid}/notifications? access_token= ... href= ... & template= ...`? Or do you POST to the URL ` https://graph.facebook.com/{recipient_userid}/notifications` and the POST body should be `access_token= ... href= ... & template= ...` – Alexander Farber Feb 01 '18 at 18:20
2

Update : Please check oneamongu's answer below. In my old answer I was referring to the custom notifications. oneamongu defined the requests structure very well below.

Old answer : Facebook Notifications were outdated by facebook about 1 year ago. Instead, you can post on a user's wall if you wanna inform him.

Inam Abbas
  • 1,480
  • 14
  • 28
  • Then how does Farmville and other apps post notifications? I need special permissions from the user when connecting via FB connect to post on their wall, right? – at. Jan 06 '11 at 20:13
  • You are talking about the notifications under that globe icon on user page right? Those are outdated by facebook for about an year ago previously these notifications were send through a notification_send method in API but when facebook blocks it after that no one can send this. But recently facebook place a notification themselves when a user invites to their friend to an application that is submitted in facebook directory I think you see any of these notifications. But for developers its not available now. – Inam Abbas Jan 06 '11 at 21:00
  • And to post on user's wall you need an extended permission called "stream_publish" you can find here a good example of it with javascript http://thinkdiff.net/facebook/graph-api-javascript-base-facebook-connect-tutorial/ and if you want to do this with php here is another example http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/ – Inam Abbas Jan 06 '11 at 21:03
  • 4
    I'm looking at that globe icon notifications dropdown and I see 3 notifications today from various people like this: "John Smith sent you a request in Treasure Isle." I opened that application a long time ago and never even use it. So I guess this is just a request that looks like it's coming from Treasure Isle... hmm... so I guess 1 way to communicate with our FB users is to just do so from my own FB account and send them requests? Can I send them messages that way? Is there a limit we could send? – at. Jan 06 '11 at 21:15
  • There is an invite limit start from 4-16 to a new born app but an application like farmvilla who got about 80million users have got greater invite limit then any other app. No message will be displayed under message icon not under globe icon. – Inam Abbas Jan 06 '11 at 21:27
1

because when I run the query: {recipient_userid}/notifications? access_token= ... href= ... & template= ...

it's work only in facebook WEB?

I see the notification on the web facebook, but do not see it on facebook Mobile?

Luca
  • 11
  • 1