FeedHive / twitter-api-client

A user-friendly Node.js / JavaScript client library for interacting with the Twitter API.
MIT License
948 stars 84 forks source link

Include an example on how to upload an image with a tweet #75

Closed lilsweetkara closed 3 years ago

lilsweetkara commented 3 years ago

Sorry about the noise and thank you for the library. I need to publish tweets with images in them. The image is actually public and online -- however, my understanding is that the Twitter API requires you to upload the image with the API. I am banging my head against the wall trying to make this happen.

Are you able to give me some guidance on how publish a tweet with a photo?

I believe this requires uploading of media first, and then posting of the twitter using the media ID.

When I post, if the image is on an URL, am I able to pass it a stream, so that I don't have to download it from the internet first? Are you able to give me some guidance/working code to do that?

Oh yes, the feature request: please add this as an example in your README!

SimonHoiberg commented 3 years ago

Hi, @lilsweetkara. Thank you for creating this issue.

Twitter has covered this in their own documentation for the media upload endpoint.

But I agree, it can be a bit tedious the first time you have to set it up.

We are going to include a method in the library that'll handle uploading, chucking and posting media, so that you can call a single method in the Twitter API Client to take care of all that.

In terms of documentation, we can't really provide better ones than Twitter has already provided - so maybe you need to create a request at the Twitter Developer team instead.

I'll close this issue for now :blush:

lilsweetkara commented 3 years ago

No worries, thank you!

On Sun, 9 May 2021 at 19:58, Simon Høiberg @.***> wrote:

Hi, @lilsweetkara https://github.com/lilsweetkara. Thank you for creating this issue.

Twitter has covered this in their own documentation https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload for the media upload endpoint.

But I agree, it can be a bit tedious the first time you have to set it up.

We are going to include a method in the library that'll handle uploading, chucking and posting media, so that you can call a single method in the Twitter API Client to take care of all that.

In terms of documentation, we can't really provide better ones than Twitter has already provided - so maybe you need to create a request at the Twitter Developer team instead.

I'll close this issue for now 😊

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FeedHive/twitter-api-client/issues/75#issuecomment-835791755, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT2N3MFZ4Y54Y3GCKCCK4VTTMZ2FTANCNFSM437QO6LQ .

platform-kit commented 2 years ago

@SimonHoiberg any update on the aforementioned method?