Skip to content

Instantly share code, notes, and snippets.

@dance2die
Created July 28, 2019 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/c4e463b8fa949d1fe7ae5761dd7ed3f9 to your computer and use it in GitHub Desktop.
Save dance2die/c4e463b8fa949d1fe7ae5761dd7ed3f9 to your computer and use it in GitHub Desktop.
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