views:

537

answers:

1

For my invitation feature of my Facebook Connect app I need to be able to tell which invitation a user responds to. I have decided to rely on the Facebook UID for that. How can I include that ID in the url that Facebook generates for fb:req-choice?

<fb:request-form action="#{@post_url}"
                method="POST"
                invite="true"
                type="my_app"
                content="<fb:name uid='#{current_user.facebook_uid}' useyou='false' /> wants to invite you to to my_app. To join him simple click 'Accept' below.<fb:req-choice url='http://my_app.com/invitation/?fb_uid={uid}' label='Accept' />">
   <fb:multi-friend-selector
              showborder="false"
              actiontext="Invite your Facebook Friends to shop on Yumshare" />
</fb:request-form>

Notice the {uid} in the url attrib for fb:req-choice. This is supposed to be the uid of the user that is being invited and therefore needs to be filled in on Facebooks side. Is that possible?

+1  A: 

The solution I used is not totally equivalent to the above, but close enough.

When loading the page containing the fb:req-choice form, generate a unique token, which of course has to be persisted at that point, and stick that into the acceptance url. Like so:

<fb:request-form action="#{@post_url}"
                method="POST"
                invite="true"
                type="my_app"
                content="<fb:name uid='#{current_user.facebook_uid}' useyou='false' /> wants to invite you to to my_app. To join him simple click 'Accept' below.<fb:req-choice url='http://my_app.com/invitation/?token=#{@token}' label='Accept' />">
   <fb:multi-friend-selector
              showborder="false"
              actiontext="Invite your Facebook Friends to shop on Yumshare" />
</fb:request-form>

That way you can track the invitation but only in the batch of friends that the user invited in that action.

derfred
Don't GET variables get deleted during a POST action? I faintly remember I once had to to split a registration into two steps, because of that.
mdm

related questions