Facebook apprequests - seems to ignore friend ids that I pass in.

I’m looking to add the functionality to invite friends to my game using:

facebook.showDialog("apprequests", {title="Invite", message="Come and play our game", ids=inviteIDs}) 

where inviteIDs is a string of facebook IDs seperated by commas:

inviteIDs = "123456798,987654321,95175348"

I’m having a few problems. The dialog does appear, and I can send invites ok, but it doesn’t show me the users whose ID I have provided. Instead I just get a random selection of my friends.

In addition to this, it splits the list into 2 parts “Ask Friends” and “Invite Friends”.

The friends in the “Ask Friends” section are mostly (but not entirely) people who have already installed the game and logged into Facebook. We don’t want this list, since we have no reason at the moment for people to contact friends who are already playing, we just want to use the dialog to allow invitations to be sent to new friends.

Does anyone know if there is a way to only allow the dialog to show the “Invite Friends” list?

Try making it a table: 

inviteIDs =  {“123456798”,“987654321”,“95175348” }

Also your quotes above don’t make a valid string.  Each value should be a string in a table.

The string was a typo, I’ve now edited it.

Normally I would have assumed the list of ids would be a table, but I couldn’t find any docs for apprequests other than this:

http://docs.coronalabs.com/api/library/facebook/showDialog.html

which doesn’t show the ids, only the message. It also has a link to the facebook docs, but they don’t seem to help much either.

The reason I used a single string of ids is because someone in this post said so: 

http://forums.coronalabs.com/topic/47672-invite-friends-in-graph-20/

I’ve just tried using a table for the user ids, and I get the following error:

unrecognized selector sent to instance 0x1a373600

When I passed in a string, although it didn’t show the friends I wanted, it did at least work.

I think it’s better to see this rather then Corona Docs when it comes to Facebook (sorry CL but it’s true): https://developers.facebook.com/docs/games/requests/v2.0
 
There are js examples, but exacly the same fields naming is used. As listed in table in the middle of page:
 
Parameter Description Required
to
Either a user id,username or invite token, or a comma-separated list of user ids,usernames or invite tokens. These may or may not be a friend of the sender. If this is specified by the app, the sender will not have a choice of recipients. If not, the sender will see a multi-friend selector
No

So as you can see, it must be string of comma separated ids as to=“123,456,789”
 
What’s more:
 

filters

This controls the set of friends someone sees if a multi-friend selector is shown. If left empty, the multi-friend selector will display all of the user’s Facebook friends.

By specifying app_users, the multi-friend selector will only display friends who are existing users of the app. This should be used when using requests for matchmaking.

Alternatively, by specifying ‘app_non_users’, the sender will only see friends who have previously not authenticated the app. This should be used when using requests for inviting new users to the game.

An app can also suggest custom filters as dictionaries withname and user_ids keys, which respectively have values that are a string and a list of user ids. name is the name of the custom filter that will show in the selector. user_ids is the list of friends to include, in the order they are to appear.

Note: On the mobile SDKs only the app_users andapp_non_users filters are supported. In addition, this parameter can not be used together with suggestions, using the two in the same dialog will result with an error.

No

@piotz55, no offense taken.  There is no way we can’t provide all of Facebook’s documentation for them.  It’s too much of a moving target for us to even try and keep up with their changes.  Your best source of information about how to use facebook is their documentation.

Rob

Sorry, didn’t mean this way. I just wanted to point that it’s just better so see FB page for reference. I should explain it like you. 

People generaly tend to miss 

String. The dialog you want to show, for example “feed” or “apprequests”. See this guide for more information.

@piotrz55

Using “app_non_users” did the trick:

facebook.showDialog("apprequests", {title="Invite some friends", message="My message", filters = "app\_non\_users"})

The above code only shows my friends who do not play the game, thanks.

Try making it a table: 

inviteIDs =  {“123456798”,“987654321”,“95175348” }

Also your quotes above don’t make a valid string.  Each value should be a string in a table.

The string was a typo, I’ve now edited it.

Normally I would have assumed the list of ids would be a table, but I couldn’t find any docs for apprequests other than this:

http://docs.coronalabs.com/api/library/facebook/showDialog.html

which doesn’t show the ids, only the message. It also has a link to the facebook docs, but they don’t seem to help much either.

The reason I used a single string of ids is because someone in this post said so: 

http://forums.coronalabs.com/topic/47672-invite-friends-in-graph-20/

I’ve just tried using a table for the user ids, and I get the following error:

unrecognized selector sent to instance 0x1a373600

When I passed in a string, although it didn’t show the friends I wanted, it did at least work.

I think it’s better to see this rather then Corona Docs when it comes to Facebook (sorry CL but it’s true): https://developers.facebook.com/docs/games/requests/v2.0
 
There are js examples, but exacly the same fields naming is used. As listed in table in the middle of page:
 
Parameter Description Required
to
Either a user id,username or invite token, or a comma-separated list of user ids,usernames or invite tokens. These may or may not be a friend of the sender. If this is specified by the app, the sender will not have a choice of recipients. If not, the sender will see a multi-friend selector
No

So as you can see, it must be string of comma separated ids as to=“123,456,789”
 
What’s more:
 

filters

This controls the set of friends someone sees if a multi-friend selector is shown. If left empty, the multi-friend selector will display all of the user’s Facebook friends.

By specifying app_users, the multi-friend selector will only display friends who are existing users of the app. This should be used when using requests for matchmaking.

Alternatively, by specifying ‘app_non_users’, the sender will only see friends who have previously not authenticated the app. This should be used when using requests for inviting new users to the game.

An app can also suggest custom filters as dictionaries withname and user_ids keys, which respectively have values that are a string and a list of user ids. name is the name of the custom filter that will show in the selector. user_ids is the list of friends to include, in the order they are to appear.

Note: On the mobile SDKs only the app_users andapp_non_users filters are supported. In addition, this parameter can not be used together with suggestions, using the two in the same dialog will result with an error.

No

@piotz55, no offense taken.  There is no way we can’t provide all of Facebook’s documentation for them.  It’s too much of a moving target for us to even try and keep up with their changes.  Your best source of information about how to use facebook is their documentation.

Rob

Sorry, didn’t mean this way. I just wanted to point that it’s just better so see FB page for reference. I should explain it like you. 

People generaly tend to miss 

String. The dialog you want to show, for example “feed” or “apprequests”. See this guide for more information.

@piotrz55

Using “app_non_users” did the trick:

facebook.showDialog("apprequests", {title="Invite some friends", message="My message", filters = "app\_non\_users"})

The above code only shows my friends who do not play the game, thanks.