N8N Tools - X (Twitter) Enhanced icon

N8N Tools - X (Twitter) Enhanced

Comprehensive X (Twitter) API v2 integration for N8N workflows

Overview

This node provides an enhanced integration with the X (formerly Twitter) API v2, allowing users to perform a wide range of Twitter-related actions within n8n workflows. Specifically for the Tweets resource and the Unretweet Tweet operation, it enables users to remove a retweet they previously made on a specific tweet.

Common scenarios where this node is beneficial include:

  • Automating social media management tasks such as undoing retweets based on certain conditions or triggers.
  • Integrating Twitter interactions into broader workflows, e.g., unretweeting tweets after a campaign ends.
  • Managing user engagement programmatically without manual intervention.

Practical example:

  • A marketing team uses this node in a workflow that monitors trending tweets and retweets them automatically. After 24 hours, the workflow runs again to unretweet those tweets to keep the account's timeline clean and relevant.

Properties

Name Meaning
Tweet ID The unique identifier of the tweet to unretweet.
Include Private Metrics Whether to include private metrics in responses (requires elevated access).
Custom Fields Comma-separated list of additional custom fields to include in the response.
Custom Expansions Comma-separated list of expansions to include in the response for richer data.

Output

The node outputs JSON data representing the result of the unretweet action. This typically includes confirmation details from the Twitter API indicating whether the unretweet was successful.

  • The output JSON structure corresponds directly to the Twitter API response for the unretweet endpoint.
  • No binary data output is produced by this operation.

Example output snippet (conceptual):

{
  "data": {
    "retweeted": false,
    "tweet_id": "1234567890"
  }
}

Dependencies

  • Requires an active subscription and valid API key for the external service called "N8N Tools API" which validates usage before calling Twitter.
  • Requires OAuth2 credentials or API authentication tokens configured in n8n to access the Twitter API.
  • The node depends on the bundled TwitterApi class for interacting with Twitter endpoints.

Troubleshooting

  • Invalid subscription or API key error: If the node throws an error about invalid subscription or API key, verify that the API key credential for the external validation service is correct and active.
  • Permission errors: Ensure the Twitter API credentials have the necessary permissions to unretweet tweets on behalf of the authenticated user.
  • Tweet ID issues: Providing an incorrect or non-existent Tweet ID will cause the operation to fail. Double-check the Tweet ID input.
  • Rate limits: Twitter API rate limits may cause temporary failures; handle these by implementing retry logic or respecting rate limits.
  • Unsupported file upload URLs: For media operations (not relevant here), base64 encoded data must be used instead of URLs.

Links and References

Discussion