Created
July 28, 2019 22:23
-
-
Save dance2die/c4e463b8fa949d1fe7ae5761dd7ed3f9 to your computer and use it in GitHub Desktop.
This file contains 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 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