I’ve created a workflow for posting tweets to X (formerly Twitter) with media attachments. I wanted to share this solution since many users have been asking about this functionality.
Important API Update
X is deprecating the v1.1 media upload endpoint on March 31, 2025. The new endpoint /2/media/upload requires the media.write scope, which isn’t currently included in the n8n TwitterOAuth2API credentials.
Temporary Workaround
Until my PR is merged to officially add this scope, here’s how you can make it work:
When connecting to X in n8n, simply add +media.write to the end of the authorization URL during the OAuth process.
Copy the URL from the authorization popup, open a new tab, paste it, and then add +media.write
Working Example
I’ve attached a sample workflow that demonstrates how to post tweets with media using this method. Feel free to import it and adapt it to your needs.
for some reason I’m getting this error even if the credentials are correctly created: Unable to sign without access token
Error details
Other info
Node type
n8n-nodes-base.twitter
Node version
2 (Latest)
n8n version
1.74.1 (Self Hosted)
Time
3/27/2025, 8:38:43 PM
Stack trace
NodeApiError: Unable to sign without access token at ExecuteContext.twitterApiRequest (/root/.nvm/versions/node/v22.13.0/lib/node_modules/n8n/node_modules/n8n-nodes-base/nodes/Twitter/V2/GenericFunctions.ts:55:9) at ExecuteContext.execute
Attachements are not supported due to Twitter V2 API limitations
I have done everything a second time just to make sure but same error. You are using OAuth 2.0 Client ID and Client Secret right? its the only id working for me.
Good morning, I am trying to get this working. forgetting the ignorance, but where do we add that piece of text? I don’t see where it’s supposed to go. I’ve looked at your working example up and down, and I don’t see where it’s added at. Could you maybe explain it please?
Okay, never mind. I got it. I ended up opening a new window, pasting that link, and then adding the +media.right, like you said, and it worked. Amazing. Thank you!
I wanted to ask if you know how we could post multiple media files in one post? Currently, I can only post with one image. I’ve tried attaching lists and JSON arrays, but I can’t find a way to do it, and I haven’t seen any posts about this either.
I think it’s not supported in the n8n X node yet, It seems like the node’s “Media ID” field is defined as a simple string rather than an array. Because of this, when you enter a value that looks like an array (or try to use multiple IDs), n8n serializes it as a string instead of an actual JSON array.
To be honest, this is a bit advanced for me.
But the simplest workaround is to use the HTTP node and call the endpoint directly—it will work…
Hi my friend, I managed to configure it without any problems, it was very good, congratulations!!
I would like to know how I can post videos, I tried to adapt the HTTP Request node to upload media, but it keeps giving me the error “Bad request - please check your parameters
media type unrecognized”
If it is possible for you to answer me with a solution, I would be very grateful!!!