4

I have a problem with making apprequests for my website application. I can send invite with FB.ui "apprequests" method but this request is not shown on Facebook. It looks like it is blocked because it fires notification icon but in a second notification disappears.

I've found a workaround. I set application also as a canvas and make redirection from canvas to the website page. But I don't know if it will not be blocked or something in the future.

What is the recommended method to send an application requests from a website application?

Andrzej Sawoniewicz
  • 1,541
  • 2
  • 16
  • 18

3 Answers3

5

From my experience and from reading the Facebook Developer Guide, it seems like it's mandatory for you to have a Canvas defined for your Facebook app so the requests render as Notifications.

I am trying to solve a problem where these notifications show fine in the Facebook website but not on the Facebook Android client's notification popup.

Marvin Pinto
  • 30,138
  • 7
  • 37
  • 54
Roberto Andrade
  • 1,793
  • 1
  • 21
  • 27
  • 2
    Why was this -1'd? It's the right answer. From the Facebok Developer Guide: "Requests are only available for Desktop Canvas apps and not websites. Accepting a request will direct the user to the Canvas Page URL of the app that sent the Request." – ior3k Apr 10 '12 at 14:21
  • Also note that redirecting to another URL seems to be a no-no. From the [Canvas Tutorial](http://developers.facebook.com/docs/appsonfacebook/tutorial/#canvas): "Note that http://www.example.com/canvas cannot forward to another URL via HTTP redirect responses, e.g. response code 301, but has to return the response directly." The Pinterest app used to do this, but going to its canvas page now says that the app is misconfigured. – ior3k Apr 10 '12 at 14:25
3

I personnally use this code, that works :

FB.ui({method: 'apprequests', message: 'my message'},function(response){'my callback'});   

I hope this will help you.

JuSchz
  • 1,200
  • 2
  • 15
  • 30
  • I use the same code (as I said: FB.ui with "apprequests" method) with no luck. Do you have your application with only website connection? – Andrzej Sawoniewicz Jan 12 '12 at 07:16
  • i use this code directly on my facebook application, but i think there are no differences. So, your problem is probably related to configurations. Maybe your application is in sandbox ? – JuSchz Jan 12 '12 at 08:06
  • There seems to be no differences between implementations as I can send an invitation - problems is with receiving it. If I set canvas connection it works. But if I have only website connection (which is what I need) it doesn't work. – Andrzej Sawoniewicz Jan 12 '12 at 08:22
  • OK, that's looks complicated. Did you also initialize your facebook application like this : FB.init({appId: '=FACEBOOK_APP_ID?>',status: true,cookie: true,xfbml: true}); – JuSchz Jan 12 '12 at 08:38
  • Yes of course. And it works when Canvas Connection is set on https://developers.facebook.com/apps. Problem is I don't want Canvas Connection. I need Website Connection only. – Andrzej Sawoniewicz Jan 12 '12 at 08:58
0

After a bit of research and trial/error, I found that that you must use canvas.

So, to get my users out of canvas and onto my site, I created a static landing page with a large "Get Started" button hyperlink with a "target='_blank'" tag. This opens my site into a new browser window. I then used that static landing as my "CanvasURL / Secure Canvas URL" for my "App on Facebook"

Tod Birdsall
  • 17,877
  • 4
  • 38
  • 40