How to programmatically invite Facebook friends on a website
Asked Answered
S

1

13

The functionality that I need is to show a list of Facebook friends to the user on the website page with custom design, where the user can select some of them and send invites.

In API v2.0 it's possible to get a list of friends this way:

FB.api('/me/taggable_friends', function (response) {
     ...
});

But it doesn't return real users' ID that I need for invites with the next function call:

FB.ui({
    method: 'apprequests',
        message: invite_text,
        to: 'user_id_1, user_id_2'
    }, function (response) {
        ...
    }
);

How can I get these real IDs? Or how to resolve this functionality in another way? Because all the answers that I found were connected with games that don't fit me.

I need a full list of friends. Not just that already use my website (analog of the invitable_friends in-game section).

Syllogistic answered 28/8, 2014 at 11:11 Comment(0)
A
15

You are not allowed to use taggable_friends for inviting them, obviously it is for TAGGING friends and you only get a tagging token.

There is invitable_friends, but:

The invitable_friends API is only available for games that have a Facebook Canvas app implementation using version 2.0 of the Graph API.

(https://developers.facebook.com/docs/games/invitable-friends/v2.1)

I am afraid what you want to achieve is not possible. The proper way to invite friends to your website is to use the Send Dialog: https://developers.facebook.com/docs/sharing/reference/send-dialog

You can include one User ID in the "to" parameter. Of course it must be a User who authorized your App too, you can get those with /me/friends. Or better: Just open the Dialog and let the User select on his own.

Append answered 28/8, 2014 at 11:19 Comment(5)
why would you prefill it anyway? a user should choose on his own to which friends he sends something.Append
because I need user to choose friends not via FB popups, but select with checkboxes on my site with custom design some of them, or all and then click 'send invites' and just confirm his choice in FB popup. This functionality will be for several social networks and they should be in one disignSyllogistic
You can't. As explained here: developers.facebook.com/docs/apps/faq#invite_to_appFragrant
So the only way to send invites from my site is to use Send Dialog? I don't like that user must enter something. If it were any method like 'apprequests', but not for games. So that user can see his friends and just click buttons...Syllogistic
there is no workaround. if there would be a workaround, you should file a bug.Append

© 2022 - 2024 — McMap. All rights reserved.