10

Really need some help with this one!

I'm trying to send notifications from a canvas app using the new notifications API but I keep getting the following exception:

OAuthException: (#200) Only web canvas apps can send app notifications

However, the app IS loaded in the Facebook canvas -- I'm making an ajax call to my server when the user takes a particular action which triggers the notification POST request. The user has also authorized the app.

This is the code I'm using:

$graphUrl = $user_id . "/notifications";
$params = array( "access_token" => $admintoken,
             "href" => $link, 
         "template" => "string of text < 180 chars"
        );

try {
  $result = $facebook->_graph($graphUrl, 'POST', $params);
 } catch (Exception $e){
     echo $e;
 }
0

3 Answers 3

22

I just ran into this too and this is how I solved it, but this may not be relevant to you as you seem certain yours is a Canvas app. Mine is an app that mostly runs off Facebook, but has Facebook integration hooks that means users can authorise my Facebook App and then receive updates about interesting events via the Facebook framework.

I went to edit my App settings in the Facebook Developers app, look on the Settings->Basic page near the bottom. I only had "Website With Facebook Login" checked. I checked "App on Facebook" and this gave me a "Canvas Page" and various other settings. With these filled in and saved, the POST to uid/notifications worked immediately.

Incidentally, going to apps.facebook.com/myappnamehere fails because it redirects to https and the request to my site fails because my SSL isn't set up right, but this didn't prevent notifications being sent under that apps credentials.

0
2

Recently, I was facing this same issue and I found that Facebook Web Games are formally known as Facebook Canvas.

So, Just create an Facebook game configuration under Settings->Basic page (You will see add button at the bottom of this page) and your API will start sending notifications.

0

1:\ Go to developer.facebook.com

2:\ Go to your app Settings \ Basic

3:\ Add new platform from plus at button bottom of the page

4:\ Choose Facebook Canvas

now you may need to fill form with your url

That's it

1
  • 1
    I only see Facebook Web Games, Website, IOS, Android, Windows App, Page Tab, Xbox, Playstation. I don't see Facebook Canvas
    – A.W.
    Aug 16, 2017 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.