Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How upload two images? #342

Open
Kevinsillo opened this issue Jul 26, 2020 · 1 comment
Open

How upload two images? #342

Kevinsillo opened this issue Jul 26, 2020 · 1 comment

Comments

@Kevinsillo
Copy link

How upload two images? Thank you

@Kevinsillo
Copy link
Author

I have discovered how it is done through the official documentation of Twitter. Concatenate media_id/s with commas.

var imageOne = require('fs').readFileSync('./xxxx.jpg');
var imageTwo = require('fs').readFileSync('./yyyy.jpg');
twitter.post('media/upload', {media: imageOne}, function(error, media, response) {
    var mediaOne = media.media_id_string
    twitter.post('media/upload', {media: imageTwo}, function(error, media, response) {
        var mediaTwo = media.media_id_string
        var status = {
            status: 'Text of tweet',
            media_ids: mediaOne+','+mediaTwo // <-------------  CONCAT WITH COMMAS
        }
        console.log(status)
        twitter.post('statuses/update', status, async function(error, tweet, response) {
        });
    })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant