I know that I need to use the data like this, in order to send data to my facebook canvas app:

FB.init({appId: '#{Facebook::APP_ID}', xfbml: true, cookie: true});
FB.ui({  method: 'apprequests', message: 'Invite Friends to Blabloo...',
           data: '{\"draw_token\":\"#{@draw.token}\",\"invitation_token\":\"#{current_kid.invitation_token}\"}',
    exclude_ids: #{@draw.get_invited_ids_for current_kid}},handle_fb_callback);

and this send a Facebook invitation, that show you my registration form inside a cavas Facebook app, now on this registration form, on my new action, I need to get this draw_token and invitation_token.

How can I get this information?

NOTE: I'm using the koala gem

有帮助吗?

解决方案

This data field that you sent is specific for that request you send to the user.

Here are the steps to follow to work with this:

  1. When the recipient clicks the requests and redirected to your application with the request_ids parameter, you should then get the data for the requests.

  2. To get the requests from the user, make the call-

    {user-id}/apprequests

  3. You will get a list of the requests and the data for each one (if any).

  4. The requests are accumulated and of-course cannot disappear by itself, so you need to delete the request once the user has accepted. To delete a request, make the call-

    /{request-id}?method=delete

You can see this example from the developers site.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top