X

Interact with X (Twitter) API

Tweet → Search v1.1

AI-generated

Overview

This node enables searching tweets using the Twitter API v1.1 search endpoint. It allows users to query historical tweets based on various parameters such as keywords, date ranges, and tweet IDs. This operation is useful for social media monitoring, sentiment analysis, trend tracking, or gathering data for research.

For example, you can use this node to:

  • Retrieve up to 100 tweets containing a specific hashtag posted before a certain date.
  • Collect tweets posted after a particular tweet ID to monitor ongoing conversations.
  • Fetch tweets with IDs less than a specified value to paginate through older tweets.

Properties

Name Meaning
Authentication Method of authentication: "OAuth1.0a" or "Bearer Token".
Query The search query string (keywords, hashtags, operators) to find matching tweets.
Count Number of tweets to return, maximum 100.
Until Returns tweets created before this date (format: YYYY-MM-DD).
Since ID Returns results with an ID greater than this specified tweet ID (for fetching newer tweets).
Max ID Returns results with an ID less than this specified tweet ID (for fetching older tweets).

Output

The output is a JSON array where each item represents a tweet object returned by the Twitter API v1.1 search endpoint. Each tweet object includes detailed information such as:

  • Tweet content (full text)
  • Tweet metadata (creation date, tweet ID)
  • Entities and media included in the tweet
  • User information associated with the tweet

No binary data is output by this operation.

Dependencies

  • Requires valid Twitter API credentials configured in n8n:
    • Either OAuth 1.0a credentials or a Bearer Token for authentication.
  • Uses Twitter API v1.1 endpoint /1.1/search/tweets.json.
  • No additional external dependencies beyond the Twitter API and n8n credential setup.

Troubleshooting

  • Common issues:

    • Invalid or expired credentials will cause authentication errors.
    • Exceeding Twitter API rate limits may result in HTTP 429 errors.
    • Incorrect date format for the Until parameter can cause request failures.
    • Providing invalid tweet IDs for Since ID or Max ID may yield empty results or errors.
  • Error messages:

    • Authentication errors: Verify that your API keys or tokens are correct and have necessary permissions.
    • Rate limit exceeded: Wait for the rate limit window to reset or reduce request frequency.
    • Invalid parameter errors: Check that all input fields follow the expected formats and constraints.

Links and References

Discussion