Last active
March 5, 2016 21:50
-
-
Save jcipriano/fb219f04ffeeebf15dea to your computer and use it in GitHub Desktop.
Post a Tweet with the Twit Node.js module.
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
var Twit = require('twit') | |
var twitter = new Twit({ | |
consumer_key: '', | |
consumer_secret: '', | |
access_token: '', | |
access_token_secret: '' | |
}); | |
var filePath = 'path/to/video/file' | |
twitter.postMediaChunked({ file_path: filePath }, function (err, data, response) { | |
console.log(data); | |
var params = { | |
status: 'Post from node.js script.', | |
media_ids: [data.media_id_string] | |
} | |
twitter.post('statuses/update', params, function (err, data, response) { | |
console.log(data) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
npm install twit --save