Twitter Media Uploader

Upload media to Twitter with specified media type

Overview

The Twitter Media Uploader node allows you to upload media files (such as images or videos) from n8n workflows directly to Twitter. It is particularly useful for automating social media content publishing, managing media assets, or integrating Twitter uploads into larger automation pipelines. For example, you could use this node to automatically post user-generated content, scheduled marketing materials, or event-driven media updates to a Twitter account.

Properties

Name Type Meaning
Binary Property String Name of the binary property in the input item that contains the file to upload. Defaults to data.

Output

The node outputs an array of items, each containing:

{
  "mediaId": "<Twitter media ID>",
  "mediaType": "<MIME type of uploaded file>",
  "originalFileName": "<Original file name>"
}
  • If an error occurs and "Continue On Fail" is enabled, the output will instead include:
    • error: Error message.
    • binaryPropertyName: The binary property attempted.
    • fullErrorDetails: Detailed error information (name, message, stack).

If the node is used to upload binary data, it refers to the file specified by the "Binary Property".

Dependencies

  • External Service: Requires valid Twitter API credentials (API Key, API Secret, Access Token, Access Token Secret).
  • n8n Credentials: Must configure a credential named twitterMediaUploaderApi in n8n.
  • Node.js Modules: Uses twitter-api-v2, os, and fs modules (these are handled internally by n8n).

Troubleshooting

  • Common Issues:

    • Missing Binary Property: If the specified binary property does not exist, the node throws:
      Binary property '<property>' not found
      • Resolution: Ensure the correct binary property name is provided and that the input item contains the expected binary data.
    • File Too Large: If the file exceeds Twitter's size limits (5MB for images, 512MB for videos), the node throws:
      Media file too large. Max size is ... Current size: ...
      • Resolution: Check your file size and ensure it meets Twitter's requirements.
    • Twitter API Errors: If the upload fails due to Twitter API issues, the node throws:
      Twitter API Upload Failed: <error details>
      • Resolution: Review the error details for more information. Common causes include invalid credentials, unsupported file types, or network issues.
  • Continue On Fail: If enabled, errors are reported in the output rather than stopping the workflow.

Links and References

Discussion