Skip to content

Instantly share code, notes, and snippets.

@dance2die dance2die/twitter.js
Created Jul 28, 2019

Embed
What would you like to do?
const Twitter = require('twitter')
const config = {
consumer_key: 'secret',
consumer_secret: 'secret',
access_token_key: 'secret',
access_token_secret: 'secret',
}
const client = new Twitter(config)
// https://github.com/desmondmorris/node-twitter#promises
const update = (status, in_reply_to_status_id = null) =>
client.post('statuses/update', {
status,
in_reply_to_status_id,
username: '@dance2die',
})
update('Testing twitter NPM library')
.then(tweet => {
console.log(`tweet #1 ==>`, tweet)
return update('Reply #1', tweet.id_str)
})
.catch(error => console.log(`error ==>`, error))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.