开发者

Sending Facebook notifications

开发者 https://www.devze.com 2022-12-26 13:15 出处:网络
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 q

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 query, 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 t开发者_JAVA技巧hing 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.


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 .


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消