1

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

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Jean
  • 5,201
  • 11
  • 51
  • 87
  • Maybe this will help you out, although the examples are in PHP the logic is the same https://developers.facebook.com/docs/games/requests – Fabio Antunes Mar 25 '14 at 17:03

1 Answers1

1

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.

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
  • @Jean, did you got the logic? – Sahil Mittal Apr 09 '14 at 19:26
  • Thanks Sahil, but I still don't getting...I send the invitation using my rails apps, the facebook user recive and invitacion y when the user makes click on this invitation, he goes to a url like this https://apps.facebook.com/blabloo_lang_dev/?fb_source=notification&request_ids=385630418244836%2C1484401528439863&ref=notif&app_request_type=user_to_user&notif_t=app_request but what do I have to do on this page to get the value invitation_token that I send using the data attribute on the js – Jean Apr 10 '14 at 07:59
  • `he goes to a url like this apps.facebook.com/blabloo_lang_dev/…` - after your this step start with my step-1, then it will make sense to you. (if you'll check this url you wrote- app.facebook.com..., must have `request_ids` appended in the last) – Sahil Mittal Apr 10 '14 at 08:06
  • Sorry But I can make this work...do you have any rails example, because I passing the data using the JS, but now I don't know how to get the data – Jean Apr 10 '14 at 10:10
  • Sorry but I didn't got you exactly what you are trying to say. – Sahil Mittal Apr 10 '14 at 11:12