Facebook app invites with RoR 8

Posted by Andrew Wed, 19 Sep 2007 20:25:00 GMT

Ray and I spent quite a while to get everything in our Facebook app to work. There were some blog posts about how get invites to work but they are outdated (and they involve some nasty FQLs).

One thing that I did was to create a beta fb application to test all this stuff out with our beta server, this helps a lot.

So in case you’re going crazy adding invites to your fb app, here’s how we did it. Keep in mind that the fb platform changes rapidly so by the time you read this there is probably a better way to do invites.

In your canvas partial, add a link to http://apps.facebook.com/[yourappname]/invite

here’s how our invite method looks like:

  def invite
    @appname = ENV['RAILS_ENV'] == 'production' ? 'onmylist' : 'onmylist_beta'
    @appid = ENV['RAILS_ENV'] == 'production' ? 12345678 : 01234567

    if fbsession.is_valid?
      @friends2exclude = fbsession.friends_getAppUsers.uid_list        
    end

    render :partial => "select_fbml" 
  end

note: app id’s are not real! :)

Here’s the select_fbml partial:

<fb:fbml>
<fb:subtitle>Invite your friends to join OnMyList</fb:subtitle>

<div style="background-color:#f2fbdc;padding-bottom:0;margin-bottom:0">

<% join_button = CGI::escapeHTML "<fb:req-choice url='http://www.facebook.com/apps/application.php?id=#{@appid}' label='Join OnMyList'>" %>

<fb:request-form 
method="POST" 
invite="true" 
type="OnMyList" 
action="http://apps.facebook.com/<%= @appname %>/"
content="Let's join OnMyList so you can list your pants off! <%= join_button %>">

<fb:multi-friend-selector
rows="5"
exclude_ids="<%= @friends2exclude.join(',') %>"
showborder="false" 
actiontext="Here are your friends who don't have OnMyList. Invite them now!">
</fb:request-form>

</div>
</fb:fbml>

the exclude_ids param is to exclude your friends who already have the app installed.

Trackbacks

Use the following link to trackback from your own site:
http://blog.onmylist.com/articles/trackback/25

  1. If you’re interested in getting invites to work with your Facebook app in Ruby on Rails, I just wrote up a quick howto at the OML blog. Technorati Tags: facebook, Rails, RoR, ruby, rubyonrails ...
  2. We have spent the last 2 days to fix, improve, clean up the OnMyList facebook app. There is this new way of using FBML to do invitations. I figure it will help some other folks out as well. If you are looking to spread some viral on facebook, take...
  3. Make Money Online From http://chedder.thelookingspot.net/?page_id=19
    Finally a Site that pays YOU,Make Money Online
  4. Advanced degree real estate law. From Law degree online.
    Law degree 6 years. Conservation law enforcement degree online courses. Law enforcement college degree. Law degree. Online mba law degree.
  5. information From resouces stuff
    resources
  6. Resources From resouces stuff
    resources
  7. Buy fax machine copier printer. From Free sales tips copier reps.
    Copier paper. Canon pc720 copier. Copier company mission statement. Cd copier free software. Magic dvd copier. Onhar slide copier. Dvd copier. Cd copier.
  8. The Key to Real Estate Success From The Key to Real Estate Success
    very intresting stuff to read
  9. Atomoxetine hydrochloride. From Atomoxetine.
    Eli lilly atomoxetine hci. Eli lilly atomoxetine.
  10. Buy cialis. Cialis discount american pharmacy. Cialis best price buy online. Cialis viagra levitra. Cheapest generic cialis. Purchase cialis online. Cialis lawyer columbus. Cialis.
  11. Ass rape. From Rape.
    Rape stories. Lesbian rape stories. Rape fantasy story. Real rape. Teen rape. Rape movies.
  12. Free xxx video. From Free xxx galleries.
    Free xxx. Free xxx pictures. Xxx free video clips.
Comments

Leave a response

  1. Avatar
    Charlie 2 months later:
    Hey, Great code piece, it helps a lot. I have a quick question. Do you know if its possible to extract the number of invited users and use that in your rails app? Thanks, Charlie - rcwhite@colby.edu
  2. Avatar
    Raymond Law 2 months later:
    I don't think so, because Facebook handles the actual invitation. We used the above code to generate and present the invitation page in Facebook. After the user selects friends to invite and Facebook sends the invitations, the user is redirected to the canvas page, I believe.
  3. Avatar
    yagnesh 7 months later:
    I’ve having the same problem as fs above. I get an 500 -Internal Server Error and the stack trace leads back to require “facebook_rails_controller_extensions”. Does anyone have any idea what that is about?
  4. Avatar
    Bernard Stark 9 months later:
    vizarded trivia cubiform caza nonabstemious uncorruptive enlargeableness requench http://www.timkoenning.com/ >American Wealth Management, Inc. http://www.hamiltonrescue.org/
  5. Avatar
    Valerie Rosario 9 months later:
    vizarded trivia cubiform caza nonabstemious uncorruptive enlargeableness requench http://www.tente.com/ >Tente-Rollen GmbH & Co. http://www.liverpool-community.org.uk/
  6. Avatar
    Amber Marks about 1 year later:
    bj6ujv4gijle0izz
  7. Avatar
    Sagogigmercito about 1 year later:
    kwynzszjwdjbqoedwell, hi admin adn people nice forum indeed. how's life? hope it's introduce branch ;)
  8. Avatar
    nicky dunnin about 1 year later:
    Hello, Great code piece .Really it works.. Thanks
Comments