3

I've got this situation:

  • TheSite is a website that uses Facebook Connect for authorization; its members' FB friend relations are also used to determine privileges on the site (content access, etc.). Thus there is a Facebook app that members must authorize to use the site.

  • Alice and Bob are (Facebook) friends.

  • Alice is a member of TheSite and has authorized the app; Bob is/has not.

  • Alice wants to tell Bob about TheSite and encourage him to join.

I've set this last bit up -- Alice inviting Bob -- with an apprequest dialog. It works (mostly -- see later), but I'm becoming uncertain that it's the right thing. The wording of the invitation message received by Bob -- "Alice sent you a request in TheSite" makes it sound like Bob is (supposed to be?) already a member of TheSite. Also, I haven't found a way to clear the request after Bob accepts it unless he actually becomes a member of TheSite -- I need the user's id to clear the request, but I can't get the user id until Bob's a member. I could save the request ID and clear it if Bob becomes a member, but, if he doesn't, the request is going to hang around forever, which seems wrong. There may also be issues about what happens if Charlie (another member of TheSite) also invites Bob somewhere along the line, but I haven't completely thought that through yet. I've found a few pages on the web offering fbml techniques that seem relevant, but I'm trying to stay away from those, given that fbml is going away.

So what's the right thing here? Is this not what apprequests are meant for? Should I just have Alice send Bob a simple message pointing him at TheSite? Is there something else/better to use here? Thanks!

Jim Miller
  • 3,291
  • 4
  • 39
  • 57
  • You can use the send dialog (https://developers.facebook.com/docs/reference/dialogs/send/) which will let Alice send Bob a link to TheSite with a personal message from her. It will be far more clear than the current apprequests which don't display the request message unless the user clicks on the 'Apps and Games' tab. As for deleting apprequests if the user doesn't authorize the application, this is how it's meant to be - the user will remove the request himself. – pm_ Feb 27 '12 at 15:18
  • Thanks for the response, and my bad for taking so long to respond. Anyway: Two issues with using "send" for this: (1) I didn't say this in the original note, but I'd like to let Alice send invitations to all (or a selection of) her FB friends who are not members of theSite, which apprequests and the app_non_users filter handles quite nicely. (2) The "send" page you linked to says "...applications on Facebook should use Requests when ... inviting people to use an application, or sending messages to multiple people." Any further thoughts? – Jim Miller Mar 23 '12 at 01:08
  • @JimMiller, For facebook 3.2 or above this link is applicable : http://stackoverflow.com/questions/14157784/can-we-invite-people-to-use-our-app-or-send-friend-request-from-the-app-via-face/16605625#16605625 – NeverHopeless May 20 '13 at 17:18

1 Answers1

1

The invitation dialogue links to your app page including request_ids in the url in the form &request_ids=request11111,request2222

If the recipient has already authorised the app these are readily available in the querystring.

The tricky part comes when the recipient needs to authorize the app first, because upon completion it redirects the user to your main app page and loses the request_ids parameter.

I resolved this by first storing any request_ids found in the querystring in a session variable. Then redirect to the auth process (if required). When it completes the user is redirected back to the main app url (with request_ids removed) but now I can check for request_ids in either the querystring OR the session, so this handles both scenarios gracefully.

pythonjsgeo
  • 5,122
  • 2
  • 34
  • 47