N8N Tools - X (Twitter) Enhanced icon

N8N Tools - X (Twitter) Enhanced

Comprehensive X (Twitter) API v2 integration for N8N workflows

Overview

The node provides an enhanced integration with the X (formerly Twitter) API v2, enabling comprehensive interaction with various Twitter resources including Tweets, Users, Timelines, Media, Spaces, Lists, Bookmarks, Direct Messages, Analytics, and Compliance features. Specifically for the "Lists" resource and the "Get List Members" operation, this node fetches members of a specified Twitter List.

This node is beneficial in scenarios where you want to programmatically retrieve the members of a Twitter List for analysis, monitoring, or automation purposes. For example, marketers can use it to gather members of competitor lists, community managers can monitor list memberships, or developers can integrate list member data into custom dashboards.

Properties

Name Meaning
List ID The unique identifier of the Twitter List whose members you want to retrieve.
Max Results (optional) Maximum number of list members to return (default is 10).
Custom Expansions (optional) Comma-separated list of additional expansions to include in the response.
Custom Fields (optional) Comma-separated list of additional fields to include in the response.
Include Private Metrics (optional) Whether to include private metrics in the response (requires elevated access).

Note: Only "List ID" is required; other parameters like max results, custom fields, expansions, and private metrics are optional and configurable.

Output

The output is a JSON array where each item corresponds to the data returned by the Twitter API for the requested list members. Each item contains detailed information about the users who are members of the specified list, including any requested custom fields and expansions.

The structure typically includes user profile details such as user ID, username, name, description, and optionally metrics if requested. There is no binary data output for this operation.

Example snippet of output JSON structure:

{
  "data": [
    {
      "id": "123456789",
      "name": "User Name",
      "username": "username",
      "description": "User bio",
      "...": "other requested fields"
    },
    ...
  ],
  "meta": {
    "result_count": 10,
    "next_token": "abc123"
  }
}

Dependencies

  • Requires an active subscription and valid API key credential for the external N8N Tools API service that validates usage.
  • Requires OAuth2 or API key credentials for authenticating with the Twitter API v2.
  • The node uses an internal helper class to interact with Twitter's API endpoints.
  • No additional environment variables beyond standard n8n credential configuration are needed.

Troubleshooting

  • Invalid Subscription or API Key: If the node throws an error indicating invalid subscription or API key, verify that your API key credential is correct and has an active subscription to the external validation service.
  • Twitter API Errors: Errors from Twitter API (e.g., invalid List ID, rate limits) will be surfaced. Ensure the List ID is valid and your Twitter API credentials have sufficient permissions.
  • Pagination: If the list has many members, consider handling pagination tokens to retrieve all members.
  • Include Private Metrics: Enabling private metrics requires elevated Twitter API access; otherwise, requests may fail.

Links and References

Discussion