Created
January 6, 2017 21:30
-
-
Save raed667/56b7f8feb031a82238d5843c60cf4324 to your computer and use it in GitHub Desktop.
Follow, then unfollow samir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Twitter = require('twitter'); | |
const client = new Twitter({ | |
consumer_key: 'XYZ', | |
consumer_secret: 'XYZ', | |
access_token_key: 'XYZ-XYZ', | |
access_token_secret: 'XYZ' | |
}); | |
const params = { | |
screen_name: 'samirnassar' | |
}; | |
client.get('friendships/lookup', params, (error, res, response) => { | |
if (res[0].connections.includes('following')) { | |
// unfollow samir | |
client.post('friendships/destroy', params, (error, res, response) => {}); | |
} else { | |
// follow samir | |
client.post('friendships/create', params, (error, res, response) => {}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment