A script which scrapes your twitter followers, compares the current followers to a list from the previous run, then notifies you of the unfollower via IFTTT. Followed by an insult for good measure!
Based off David Crespo's Unfollowers, but modified to run without Heroku.
- Go to https://developer.twitter.com/
- Request your account be converted to a developer account (may take a couple of days...)
- Go to https://developer.twitter.com/en/apps
- Create an app with read permissions
- Note the API keys and Access tokens
- Log into your account
- Connect the webhooks service, note the URL
https://maker.ifttt.com/use/<IFTTT_KEY>
- Create a webhooks applet with an event
new_unfollowers
as its trigger and a notification as its effect. Set{{Value1}}
as the contents of the notification. - Install the IFTTT app on your phone and log in. Make sure you give it permission to send you notifications.
-
Go through all the steps above
-
Install Node if you don't have it
-
Run
npm i
in the repo directory -
Set all of the variables in config.js to the keys from earlier
-
Run
node index.js
. Output should look like this:$ node index.js Successfully written to file.
That proves the connectionto Twitter is working.
-
Run
node test-notification.js
. Output should look like this$ node test-notification.js Posted to IFTTT: "This is a test notification!"
and you should get a notification on your phone
You can either follow the instructions below or use David's repo, hosting it with Heroku.
- Using a raspberry pi, complete the steps above again.
- Install screen
- Start a screen session
screen
- Run
watch -n300 -x node <filepath to repo>/index.js
- Disconnect from screen session
Ctrl+a
followed byd
This will run the script every 5 minutes to check for unfollowers. By running it with screen, you can disconnect from SSH and leave the Pi to do its own thing.