Twitter Media Upload icon

Twitter Media Upload

Upload media to Twitter using session tokens

Upload Media

AI-generated

Overview

This node uploads media files to Twitter using session tokens. It supports uploading media either from a URL or from binary data provided by a previous node. The node handles media initialization, chunked uploading, and finalization, including optional media processing status checks for videos. It is useful for automating media uploads to Twitter in workflows, such as posting images, videos, or GIFs programmatically.

Use Case Examples

  1. Uploading an image from a public URL to Twitter.
  2. Uploading a video file from binary data obtained from a previous node.
  3. Adding alternative text for accessibility and overriding media category detection.

Properties

Name Meaning
Session Token Twitter session token (auth_token cookie value) used for authentication.
CSRF Token Twitter CSRF token (ct0 cookie value), optional but may be required for some accounts.
Input Type Specifies whether the media is provided as a URL or as binary data from a previous node.
Media URL URL of the media file to upload (required if Input Type is Media URL).
Binary Property Name Name of the binary property containing the media data (required if Input Type is Binary Data).
Additional Options Optional settings including alternative text for accessibility, media category override, and HTTP proxy configuration.

Output

JSON

  • success - Indicates if the media upload was successful.
  • media_id - The media ID assigned by Twitter.
  • media_id_string - The media ID as a string.
  • size - Size of the uploaded media in bytes.
  • media_type - MIME type of the uploaded media.
  • media_category - Category of the media (e.g., tweet_image, tweet_video, tweet_gif).
  • fileName - Original or assigned file name of the media.
  • processing_complete - Boolean indicating if media processing (for videos) is complete.
  • expires_after_secs - Time in seconds after which the media expires.

Dependencies

  • Requires Twitter session token (auth_token cookie value) and optionally CSRF token (ct0 cookie value) for authentication.
  • Uses external libraries for MIME type detection, URL validation, and UUID generation.

Troubleshooting

  • Invalid media URL: The node validates the media URL and throws an error if invalid.
  • File size exceeds Twitter's limits: The node checks file size against Twitter's maximum allowed sizes for different media categories and throws an error if exceeded.
  • Media processing timeout: For videos, the node waits up to 5 minutes for processing to complete and throws an error if it times out.
  • Authentication errors: Ensure the session token and CSRF token (if required) are correct and valid.
  • Proxy configuration issues: If using an HTTP proxy, ensure the URL and credentials are correct.

Discussion