Actions74
- Lists Actions
- Tweets Actions
- Users Actions
- Timelines Actions
- Media Actions
- Spaces Actions
- Direct Messages Actions
- Analytics Actions
- Compliance Actions
Overview
The node provides an enhanced integration with the X (formerly Twitter) API v2, enabling various operations on Twitter resources within n8n workflows. Specifically for the Media resource and the Upload Media operation, this node allows users to upload media files such as images, videos, or GIFs to Twitter. This is useful in scenarios where you want to programmatically add media content to tweets or manage media assets on Twitter.
Practical examples include:
- Uploading a product image to attach to a promotional tweet.
- Uploading a video clip to share highlights or announcements.
- Adding GIFs to tweets for engagement or entertainment purposes.
Properties
| Name | Meaning |
|---|---|
| File Data | Base64 encoded file data or a file URL representing the media to upload. |
| Media Type | Type of media being uploaded. Options: Image, Video, GIF. |
| Alt Text | Alternative text description for accessibility purposes, describing the media content. |
| Media Category | Category label for the media, e.g., "tweet_image" or "tweet_video", used for classification. |
| Custom Fields | Comma-separated list of custom fields to include (applicable across multiple resources). |
Output
The node outputs JSON data containing the response from the Twitter API after uploading the media. This typically includes metadata about the uploaded media such as its unique media ID, type, size, and any processing status.
If the media upload is successful, the output JSON will contain details necessary for referencing the media in subsequent Twitter API calls, such as attaching the media to tweets.
The node does not output binary data directly; instead, it expects base64 encoded input for the media file.
Dependencies
- Requires an active subscription and valid API key for the external "N8N Tools API" service, which validates usage before forwarding requests to Twitter.
- Requires Twitter API credentials configured in n8n for authentication.
- The node uses the Twitter API v2 endpoints via a helper class internally.
- The media file must be provided as base64 encoded data; URL-based uploads are not supported yet.
Troubleshooting
- Invalid Subscription or API Key: If the node throws an error indicating invalid subscription or API key, verify that your API key credential for the external validation service is correct and active.
- Unsupported File Upload Method: Uploading media via URL is not implemented. Ensure the file data is base64 encoded.
- File Data Format: The
fileDataproperty must start with a base64 prefix (data:) or be raw base64 string. Incorrect formatting may cause errors. - API Rate Limits: Twitter API enforces rate limits; excessive uploads may result in throttling errors.
- Error Messages: Errors from Twitter API are propagated. Check the error message for details like invalid media type, unsupported format, or size limits.