Facebook is eager to tell you about friend requests and even makes posts when you add a new friend, notifying you about all the new Facebook relationship. It will however never inform you about changes the other way around; you cannot see anyone unfriend you. We decided to change that.

What it does

The Chrome extension works in the background and periodically checks your friend list on Facebook, by comparing your friend list to the last known one every time, it can see people disappearing from it. It saves the data on the hard drive, so it will work even if someone unfriends you while you have your browser - or even computer - off.

When it detects that someone unfriended you, it displays a desktop notification and also connects to our bot which messages you directly about that fact.

Additionally, it can also monitor the friends' lists of all your friends, informing you about the changes, so that you can know if someone unfriended one of your friends.

How we built it

We mostly used JavaScript to build the Chrome extension, utilizing AJAX for querying Facebook and HTML5 Local Storage for saving data. We built the bot in Node.js and Microsoft Bot Framework, but eventually settled on using Microsoft Flow, as it turned out to be better suited for the task, as suggested by a Microsoft representative.

Challenges we ran into

The Chrome extension was difficult to implement, as it tries to scrape Facebook's web pages without using any API's. This allows it to work without any authentication required and see the friends' lists of all your friends. Facebook's web pages load content (like the friend list) asynchronously in many steps, and so our code had to reflect that to work. After getting all the data, it had to be parsed to extract useful information from the returned mix of HTML and JavaScript.

Our bot worked locally without any issues, but after we moved it to the Microsoft Azure's bot service, we ran into a problem, as it was unable to find some Node.js modules. A Microsoft representative told us it's likely to be an unknown bug due to it being a recently introduced service. As a solution we decided to use Microsoft Flow instead, which works without issues.

Accomplishments that we're proud of

The project works exactly as we envisioned. We successfully wrote a web scraper/parser for Facebook's data and a working bot.

What we learned

We learned about the different Microsoft Azure capabilities and about the process of making Chrome extensions. We also had the chance to discover that Facebook loads it's web pages in quite a convoluted way and that it's possible to monitor Facebook users' data without their knowledge, which is a privacy issue.

What's next for Unfriendly

We could extract more data from Facebook to monitor different kinds of user activity, and notify them of interesting events concerning them even if they don't use Unfriendly themselves. This could be a way to naturally expand the user base.

Built With

Share this project: