views:

125

answers:

2

Hey i have a little facebook iframe application written with rails and the facebooker plugin. I can loop through the users friends and see whether they also have this application. To do this I use a fql qeury, and my own html (no fbml). Now i want to create a button right beside every friend who doesn't have this app, that sends an invite massage. Is it possible to do this without this FBML/JS voodoo? I looked through the RESTful api but the only thing i could found was this deprecated method :(

Can someone provide me an code example on how to do this? I really don't want to use this FBML stuff because it doesn't fit into the ui concept of the app, but if that the only way, please explain how to do this (every fbml tag I've tried is just invisible :( )

Thanks a lot.

+1  A: 

Unfortunately, your only option with an iframe app is to use the fb:serverfbml method. Within that, you are able to use the fb:request-form.

See: http://wiki.developers.facebook.com/index.php/Fb:serverFbml

Its definitely not the way I was hoping to implement one, but it works.

webguydan
ok, ill try it!
antpaw
+1  A: 

Currently for invite you can only use fb:request-form. inside fb:request-form you need following tag

fb:multi-friend-selector

like this:

<fb:fbml>
  <fb:request-form
  action="index.php" 
  method="POST" 
  invite="true" 
  type="YOUR APP NAME" 
  content="Your text goes here. <?php echo htmlentities("<fb:req-choice url=\"YOUR CANVAS URL\" label=\"Authorize My Application\"") ?>" > 
  <fb:multi-friend-selector showborder="false" actiontext="Invite your friends to use YOUR APP NAME."> 
  </fb:request-form>
  </fb:fbml>

This will display friend selector with invite button and user need to select friends and click on invite. but for you it better to use fb:request-form-submit instead of fb:multi-friend-selector with uid="target frien user id" like this:

<fb:fbml>
  <fb:request-form
  action="index.php" 
  method="POST" 
  invite="true" 
  type="YOUR APP NAME" 
  content="Your text goes here. <?php echo htmlentities("<fb:req-choice url=\"YOUR CANVAS URL\" label=\"Authorize My Application\"") ?>" > 
  <fb:request-form-submit uid="TARGETUID"/> 
  </fb:request-form>
  </fb:fbml>

this one shows just one button to invite specified person. However facebook says going to deprecate fb:request-form-submit but it still works.

For showing FBML you need to make your iframe application XFBML and for that you need to include Facebook Javascript libraries. then put any FBML you want inside . read more about XFBML to find how to convert to it, it is straightforward:

http://wiki.developers.facebook.com/index.php/XFBML

Ehsan