f3f4ed928e0aa64d0b793b8afcceda23
Around dev world

Invite your friends to your Facebook fanpage like a Dev

0 361

In this post I will show you a very easy way to invite all of your Facebook friends to like your Facebook fanpage. This is a little hack that will require some source code analyzing and dev skills. But after all, this is extremely easy.

After I created the Facebook fanpage for this blog (you can find it here: https://facebook.com/creynblog/) I decided that I want to invite all of my friends to like it. I wanted them all to join me on my path as a blogger. But the default “Facebook way” is to click them one by one on the “Invite” button next to the photo. And I had a lot of friends (222). So I decided that I will use my dev skills.

If you want to follow, please have in mind that this is not an official method and it worked on 2016-06-14 and maybe it isn’t working when you are reading this. This is more advanced stuff and you are doing it at your own risk.

So first, go to the Facebook fanpage “Invite Friends” section:

f1

Then you will see the list of your friends. Exactly 100 of your friends. So you have to scroll the list to the very bottom and as you will be doing this, you will notice that more of them are showing. So please scroll to the very bottom of the list (to have all of your friends shown). Next let’s see under the hood. I am using Chrome browser for this. So right click on the “Invite” button and choose something like “Inspect element”. The new window should open and then you can find the source code of the button:

f3

You can see that the button has a class attribute called “uiButton“. So we can select all of the buttons using javasctipt. Open the Console tab and now you can execute some code in the context of the website. Quick look at the documentation (https://developer.chrome.com/devtools/docs/console#selecting-elements) and we can see that to get all elements with specific class we should use the “$$()” function. It will give us an array of all buttons that we want to click. So if we count them we should get number of our friends. In my case there was 218, so 4 of my friends were missing. Probably there is some “don’t invite me to the fanpage” option that they selected.

And now the final step. We could execute a “clicking” action on each button. It would be exactly like we were clicking all of them manually. This is done by following script:

f4

And after just about 1 second (on Chrome browser) all of my friends were spammed with my invitation and I was so happy seeing them accepting the invitation :)

C.

Leave a Reply

DEV

Around Dev

My way of seeing

%d bloggers like this: