Unfriending someone through the Facebook API?
Asked Answered
A

3

5

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?

Augustina answered 10/11, 2011 at 23:12 Comment(1)
possible duplicate of Any way to unfriend someone using Facebook's PHP SDK?Nomination
P
13

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.

Phosphorite answered 10/11, 2011 at 23:47 Comment(3)
You cannot remove friends with a friend dialog. If that feature was ever there, it is not any longer.Phosphorite
Thanks much. Seems to be another instance of "This is X's world; we're just living in it."Augustina
Very interesting about the Burger King promo. +1.Conjugation
V
5

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"
});
Villalpando answered 26/1, 2014 at 18:23 Comment(0)
C
0

This is 2021 working code, other methods i tried were obsolete.

  1. Go to https://m.facebook.com/friends/center/friends and open browser console.
  2. Execute jquery-min defintion code from https://code.jquery.com/jquery-3.6.0.min.js into browser console.
  3. Run the following code from your brower console.

// from https://m.facebook.com/friends/center/friends  
// first copy paste: https://code.jquery.com/jquery-3.6.0.min.js


let ok = this.document 
let firstrec = ok.firstChild.nextSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.nextElementSibling.nextElementSibling.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.firstElementChild nextrec = firstrec

// simulate click function async function clickf(div, entry) {
    if (entry == null) {
        await $(div).click()
        return await $(div).click()
    }
    if (entry == "0") {
        console.log("ehhe")
        await $(div)[0].click()browse
        return await $(div)[0].click()
    } }


function* removefb() {
    while (true) {
        nextclick = nextrec.firstElementChild.nextElementSibling.nextElementSibling.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.nextElementSibling.nextElementSibling.firstElementChild
        nextreccopy = nextrec
        nextrec = nextrec.nextSibling
        if (nextrec == null) {
            nextrec = nextreccopy
            nextrec = nextrec.parentElement.nextElementSibling.firstElementChild
        }
        clickf(nextclick)

        remover = nextclick.nextElementSibling.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.firstElementChild.nextElementSibling
        clickf(remover, 0)
        yield
    } }

function greet() {
    removefb().next() }

setInterval(greet, 1000);

https://github.com/danass/remove-fb-friends/

This code help you to mass remove all facebook friends.

Chromaticness answered 23/11, 2021 at 14:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.