Unfriending someone through the Facebook API?

2020-06-19 11:10发布

Is it possible to remove a friend relationship between two FB users through the API? I'm thinking that it's not, but (if not) is it possible to at least bring up a dialog that would let the user request the unfriending, similar to how the Friends Dialog (http://developers.facebook.com/docs/reference/dialogs/friends/) lets a user send a friend invitation?

2条回答
爷、活的狠高调
2楼-- · 2020-06-19 11:20

You can do that with a browser script: Deleteting All Facebook friend programmatically using fb graph api

The script in this page is out of date, here's a working one:

$.ajax({
  url: "https://graph.facebook.com/me/friends?access_token=ACCESS_TOKEN", // get this at https://developers.facebook.com/tools/explorer take the Friends link and replace it.
  success: function(data) {
        jQuery.each(data.data, function() {
            $.ajax({
                url: "https://m.facebook.com/a/removefriend.php",
                data: "friend_id="+this.id+"&fb_dtsg=AQC4AoV0&unref=profile_gear&confirm=Confirmer",
                async: false,
                type: "post"
                }
            })
        });
  },
  dataType: "json"
});
查看更多
虎瘦雄心在
3楼-- · 2020-06-19 11:31

It is not possible through the API. Facebook is like the mafia - you can get in. but there's no way out.

Simialar to this question: Any way to unfriend or delete a friend using Facebook's PHP SDK or API?

Also, it is against the terms of service for facebook apps to ask people to unfriend. There was a BurgerKing prootional app that famously ran afoul of that after going viral. http://www.insidefacebook.com/2009/01/14/whopper-sacrifice-shut-down-by-facebook/

Let friends unfriend on their own time.

查看更多
登录 后发表回答