Post Media to X/Twitter via API (NEW)

Yeah confirm it’s working now.

need to provide the media_category and no need to go chunk solution!

3 Likes

Yes. Can confirm it as well. „media_category“ —>“tweet_image“ is required, otherwise it doesn’t work.

2 Likes

Hi friend thanks a lot for this information!! I am currently having this error if you could help sorry for disturbing I’m new with N8n

It’s depend the source for your data (image/video only)

You need a binary file to upload on X. But if it"s just text you don’t need it too.

It’s a GPT generated image, what should I do to fix?

I don’t know why you upload it to google Drive (you can also do this in parallel if necessary), but after the image generation of ChatGPT, you can insert “convert to file” node and use “move Base64 String to file” there. You will then get “data” (image) as output, which you can then feed directly into the 𝕏 Upload node. That’s it.


1 Like

@mohamed3nan Thank you so much for the information!

I would like to understand how to upload not only pictures but also videos?

Has anyone managed to do it through api v2?

Sorry for my newbie question here brother thanks for helping … I used Google Drive for an other use with the picture .. I only have only http request before uploading to X like showed in the upper example … So i don’t have access to the base 64_json like you have … could you please tell me how to set the previous http request with GPT generated picture :folded_hands:

You are using gpt-1-image model right?

It gave you a data array. Not only one file.

Please split it first and upload to twitter next


What am I missing? Also tried api.twitter. I created the API App with the n8n docs.

Did you follow the first post about the credential add +media.write scope?

2 Likes


my workflow currently always fails while uploading an image to X - can anyone help me out here?

your URL should be “fixed” not as “expression”

1 Like

I can’t upload video into X, I dont know what i need to upload. Could you help me.

thank you soooo much that was the issue!!

Hi, guys. Have the same issue with credentials. Don’t understand why? Did everything as recommended above. But still get the following error:

Please help to fix it

Dear @plemeo_AI Did you fix the issue with Credentilas? I see that you had the same problem.

anyone else encountering this issue with uploading media to X?


i now moved the nodes like in my screenshot and everything seems to be working. strange.

Any specific way to upload multiple photo in twitter?