1

I'm working on a game that has a "play with your Facebook friends" feature (it does not use Facebook Canvas). The setup is pretty standard. I want to display a list of all of the user's Facebook friends and if they are also users of my app, a "Play" button will show up, if not, an "Invite" button will show up.

To get the list of my Facebook friends which use the app, I make a call to

Request.newMyFriendsRequest

and then to get a list of all of my friends, I make another call to /me/taggable_friends.

With this info, I'm able to create such a list. The issue is that if I want to send an App Request to a user, I need their user id, but the id which is returned by the /me/taggable_friends is not the actual Facebook id of that user, but a unique id associated with my app (as explained in the documentation), so it doesn't work if I want to send an App Request using it.

To invite a friend, I'm using the following code:

Bundle params = new Bundle();
        params.putString("title", "Invite Friend");
        params.putString("message", "has invite has you to try out the game");
        params.putString("to",  id);  // how do I get this id?

        WebDialog requestsDialog = ( new WebDialog.RequestsDialogBuilder(this,
                Session.getActiveSession(), params)).setOnCompleteListener(new WebDialog.OnCompleteListener()
        {
            @Override
            public void onComplete(Bundle values, FacebookException error) {

            }
        }).build();
        requestsDialog.show();

This seems to be a pretty standard setup that I've seen in many games so I know it's possible. Any ideas what I'm doing wrong? Thanks!

Henrique
  • 4,921
  • 6
  • 36
  • 61
  • https://developers.facebook.com/docs/graph-api/reference/user/invitable_friends/ invitable friends endpoint has become deprecarted by 04.04.2018. Do you have any other approach for this? – Ilker Baltaci Apr 10 '18 at 12:10

1 Answers1

1

This, AFAIK, is not possible in v2.x of the graph API, and it's not the intent of the taggable_friends endpoint (especially given that there is an invitable_friends endpoint). I think you have 2 options:

  1. Also implement a Canvas app so you can use invitable_friends

  2. Show all friends who are already using the app (via the /friends endpoint), and then have a button that allows users to invite more friends, but without specifying which ones to invite. The dialog that pops up will have a friend selector that allows the user to pick which friends to invite.

Ming Li
  • 15,672
  • 3
  • 37
  • 35
  • Yeah, I ended up having to implement Facebook Canvas, which enables my app to use the invitable_friends API which is exactly what I wanted. Just didn't want to do it over the canvas since my app doesn't really need it. – Henrique Oct 07 '14 at 22:43