6

We have a website that uses Facebook for login. We have an invite page that displays the user's facebook friends and lets then invite them through facebook:

$('.invite_container a').live('click', function() {
    var link = $(this);
    FB.ui({method: 'apprequests',
        message: "Join me on Tailored",
        to: link.attr("user_id")
    }, function(data) {
        console.log(data);
    });
});

I get the appropriate response back from Facebook, which includes the request ID and the ID's of the users who were invited. No one ever receives the invites, and when I check the request ID in the FB graph, I get returned 'false'.

Any ideas?

Jeremy
  • 1
  • 85
  • 340
  • 366
Matt Johnston
  • 412
  • 4
  • 9

2 Answers2

17

A couple of sugegstions as to where to start looking:

  • Ensure your app is not in sandbox mode.
  • Ensure the user is not a test user that is sending invites.
  • Requests are only available for Desktop Canvas apps and not websites.
norman784
  • 2,201
  • 3
  • 24
  • 31
DMCS
  • 31,720
  • 14
  • 71
  • 104
  • Thanks for the response. I am neither in sandbox mode, nor using a test user. Any other ideas? – Matt Johnston Feb 06 '12 at 21:06
  • 6
    "_Requests are only available for Desktop Canvas apps and not websites._" <-- I forgot about this. You can't use the app invites for anything other than a canvas app. – DMCS Feb 06 '12 at 21:26
  • That's definitely the problem. I'm not sure how I missed that. – Matt Johnston Feb 06 '12 at 22:08
  • The weird thing is that Pinterest's invite page uses that exact same FB.ui function to invite you to use Pinterest and it works fine. I wonder if maybe they are actually inviting you to a canvas app instead of their website? – Matt Johnston Feb 06 '12 at 22:09
  • Correct! That's what you'll need to do. Ensure you have a canvas app that the user can go to. :) – DMCS Feb 06 '12 at 22:16
  • Great! Thanks for the help. I'd vote up your answer, but apparently I need more reputation... – Matt Johnston Feb 06 '12 at 22:44
0

I had to implement facebook ‘apprequests’ instead of the deprecated ‘appinvites’ in an existing cordova app and spent hours debugging.

So here are my lessons learned:

  • ‘apprequests’ are only available in Facebook Apps categorized as ‘games’
  • You can send notifications only to platforms (iOS, Android, Facebook web games) that are involved with the facebook app. That means, you will never receive a notification in your browser if you miss ‘facebook web games’ as platform. My expectation was to be notified in the facebook browser app if I was invited from a Mobile app.
  • If you like notifications in a browser app, you have to add ‘Facebook web games’ (formerly known as ‘canvas’) as plattform.
  • You can save yourself a lot trouble by creating test users in the app role category of your facebook app.