Created
November 7, 2014 00:19
-
-
Save ksloan/8f6948ca108f69f2b00a to your computer and use it in GitHub Desktop.
simplest image/media tweet with node
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
var request = require('request') | |
var tweet_image = function(status, imgUrl, done) { | |
var url = 'https://api.twitter.com/1.1/statuses/update_with_media.json' | |
var req = request.post(url, { | |
oauth: { | |
consumer_key: this.oauth.consumer_key, | |
consumer_secret: this.oauth.consumer_secret, | |
token: this.oauth.access_token, | |
token_secret: this.oauth.access_token_secret | |
} | |
}, done) | |
form = req.form() | |
form.append('status', status) | |
return form.append('media[]', request(imgUrl)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment