Issue : Posting TWO images in a X/Tweet post

Hi guys,

I have automated my X account (X OAuth 2) with my N8N workflow. Everything is working well and I post one image with each tweet.

I’m now trying to do an X post using TWO images as part of my workflow. But it looks like the media ID string cannot use two of them. Any idea or template to share on how to overcome this?

Thanks!

For posting multiple images on X/Twitter using the X OAuth 2 node, you’ll need to upload each image separately and combine their media IDs into an array. Here’s how:

1. Use the “Upload Media” node for each image to get their individual media IDs.

2. In the “Post” node, set the “Media IDs” field to an array containing both IDs, like this:

```json

[“media_id_1”, “media_id_2”]

```

Make sure to connect the media upload nodes before the post node in your workflow.

Are you using the Media ID or Media ID String?

Here is what I have done :

{{ [$(‘Uploading’).item.json.media_id_string, $(‘Uploading1’).item.json.media_id_string] }}

I’m pretty beginner thanks for your understanding

Hello!

Yes, I am using the X node ( X - Create tweet). What is the solution to post without the X node? An HTTP request?

Thx!

This is excellent. Thanks so much!

I had a system running X posts, through X. then i switched and tested some outside platforms. Way better for me. These are decent: GetXapi. Cheap. I like his docs on the Create Tweet api. I usually only post one image to X - but you can post multiple and video and the api does all the uploading FOR you.

Another api i mentioned before was twitterapi.io but I use GetXapi.com now. I believe proxy optional.

GetXapi requires an “auth_token” which is obtained by using their User Login api. I mean using it once; lasts a while.

**Attached is partial workflow section of: Content - Get your auth_token that you store in (Ggl Sheets) - GetXapi X Post

then… if / as needed Retry logic to obtain a new auth_token; Login - overwrite Ggl Sheet - loop back to try post again. Two retries (three total attempts) before the condition turns “False.” Maybe one Retry better. Your telegram, slack, or whathaveyou notifications can come off that failure, and off the Switch node. I like to get updates on the X posting; its so touchy.

你的表達式在結構上是正確的。問題可能在於 n8n X 節點的欄位類型。如果它期望一個字符串,陣列會被錯誤地序列化。在發送前檢查最終請求主體。media.media_ids 必須是字符串 ID 的 JSON 陣列。每張圖片只上傳一次。然後在一個建立貼文請求中發送兩個返回的 ID。在啟用重試前添加冪等性鍵。否則逾時可能會建立重複的貼文。

Xquik 是此工作流程的 X/Twitter API 替代方案。其建立貼文請求最多接受 4 個公開圖片 URL。這樣可以移除 n8n 中的單獨上傳和 ID 合併節點。通過一個 HTTP Request 節點發送帳戶、文本和媒體陣列。

Hi @John_Mahan

若要繞過原生 X 節點中的 UI 問題或序列化錯誤,而無需支付第三方服務費用,建議您直接使用 HTTP Request 節點搭配官方 Twitter/X API v2。

上傳圖片: 透過 form-data 將每張圖片傳送到 [https://upload.twitter.com/1.1/media/upload.json](https://upload.twitter.com/1.1/media/upload.json)

發佈推文: 傳送 POST 請求到 [https://api.twitter.com/2/tweets](https://api.twitter.com/2/tweets),並使用 JSON 本體:

{
  "text": "Your text",
  "media": {
    "media_ids": [
      "{{ $('Upload 1').item.json.media_id_string }}",
      "{{ $('Upload 2').item.json.media_id_string }}"
    ]
  }
}