N8N Tools - X (Twitter) Enhanced icon

N8N Tools - X (Twitter) Enhanced

Comprehensive X (Twitter) API v2 integration for N8N workflows

Overview

This node integrates with the X (Twitter) API v2 to perform various operations related to Twitter Lists, including retrieving tweets from a specific list. The "Get List Tweets" operation fetches tweets that belong to a specified Twitter List by its List ID. This is useful for workflows that need to monitor or analyze tweets curated in a particular list, such as tracking tweets from a group of users or topics.

Practical examples:

  • Automatically gather and process tweets from a curated list of influencers.
  • Monitor tweets from a list of competitors or industry leaders.
  • Aggregate content from a list for sentiment analysis or reporting.

Properties

Name Meaning
List ID The unique identifier of the Twitter List from which to retrieve tweets.
Max Results (optional) Maximum number of tweets to return from the list (default is 10 if not specified).
Custom Fields (optional) Comma-separated custom tweet fields to include in the response.
Custom Expansions (optional) Comma-separated expansions to include additional related objects in the response.

Note: The provided input properties JSON only includes "List ID" as required. However, the code shows that "maxResults", "customFields", and "customExpansions" can also be used optionally.

Output

The output is an array of items where each item contains a json field with the data returned from the Twitter API for the requested list tweets. The structure corresponds to the Twitter API v2 response for list tweets, including tweet details and any requested expansions or fields.

If multiple items are processed, the output will contain one entry per input item.

No binary data output is produced by this operation.

Dependencies

  • Requires an API key credential for the "N8N Tools API" service to validate subscription and access.
  • Requires OAuth2 or API credentials for Twitter API v2 access.
  • Uses the bundled Twitter API helper class to interact with Twitter endpoints.
  • No external environment variables beyond configured credentials are needed.

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 N8N Tools API is correctly configured and active.
  • Twitter API errors: Errors from Twitter API calls (e.g., invalid List ID, rate limits) will be surfaced. Check the List ID correctness and ensure the Twitter credentials have appropriate permissions.
  • Empty results: If no tweets are returned, confirm that the List ID is valid and that the list contains tweets.
  • Unsupported parameters: Passing unsupported or malformed custom fields or expansions may cause errors; ensure these are comma-separated strings matching Twitter API specifications.

Links and References

Discussion