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, enabling various operations on Twitter users, tweets, timelines, media, spaces, lists, direct messages, analytics, and compliance jobs. Specifically for the Users resource and the Follow User operation, it allows you to follow a specified user by their user ID or username.

Common scenarios where this node is beneficial include automating social media management tasks such as following new users based on certain criteria, integrating Twitter user interactions into workflows, or managing user relationships programmatically.

Practical example:
You can use this node in a workflow to automatically follow users who mention your brand or match specific search criteria, helping grow your network or monitor relevant accounts.

Properties

Name Meaning
User ID The ID or @username of the user to follow.
Include Private Metrics Whether to include private metrics in responses (not applicable for follow operation).
Custom Fields Comma-separated list of additional custom fields to include in the response (optional).
Custom Expansions Comma-separated list of expansions to include in the response (optional).

For the Follow User operation, only the User ID property is required and used.

Output

The node outputs JSON data representing the result of the follow action. This typically includes confirmation details from the Twitter API about the follow request, such as the followed user's information or status of the follow action.

If multiple input items are processed, the output is an array of results corresponding to each item.

No binary data output is involved in this operation.

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 OAuth2 or API key credentials configured in n8n for authenticating with the Twitter API.
  • The node depends on the bundled twitter-api helper class for making Twitter API calls.

Troubleshooting

  • Invalid subscription or API key error: If the node throws an error indicating invalid subscription or API key, verify that your N8N Tools API credentials are correct and have the necessary permissions.
  • Twitter API errors: Errors returned from Twitter (e.g., user not found, rate limits exceeded) will be surfaced. Check the user ID or username correctness and ensure your Twitter app has appropriate access levels.
  • Network issues: Connectivity problems between n8n and the external APIs may cause failures; ensure stable internet connection and no firewall blocking.
  • Continue on Fail: If enabled, the node will continue processing subsequent items even if some fail, collecting error messages per item.

Links and References

Discussion