javascript - Creating a FB Notification for my app -


i'm trying create notification app when user added list item.

i want post message such as: "you have been added item on app"

however, cant seem work out api request make , can see how send app invites.

the below code implementation return how many notifications have

fbappnotification: function (user){      for(var = 0; < user.length; i++){         fb.api('/' + user[i] + '/notifications', function(response) {             console.log(response);             if(response.success === true){                 alert('yay');             }         });     }  } 

you making call in wrong way, have provide other parameters such app access token, template etc. , app should canvas app

for more details go through notifications api tutorial on developers site, have elaborated how use api example (quite simple)

also making request (which default) instead of post (for have mention method explicitly) that's why instead of posting getting result.


code example:

fb.api('/receipient_userid/notifications',         'post',         {            access_token: app_access_token,            template: "you have been added item on app",            href: redirect_url                },         function(response)        {           if (!response || response.error)           {              alert('error occurred');           }            else            {              alert('success :d');           }        } ); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -