Skip to content

Instantly share code, notes, and snippets.

@ksloan
Created November 7, 2014 00:19
Show Gist options
  • Save ksloan/8f6948ca108f69f2b00a to your computer and use it in GitHub Desktop.
Save ksloan/8f6948ca108f69f2b00a to your computer and use it in GitHub Desktop.
simplest image/media tweet with node
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