4 min read

Search Tweets

Purpose

This node enables users to perform a recent tweet search using specified parameters. It connects to a Twitter integration, allowing retrieval of tweets based on a defined query. This component is suitable for use cases related to social media analytics, sentiment analysis, and real-time monitoring of discussions on various topics.

Settings

The searchTweets component has several configurable settings that allow users to customize the behavior and appearance of the logic.

1. Query

2. Fields

3. Max Results

4. Next Token

How It Works

  1. The component begins by destructuring the input parameters: inputs, config, and context.
  2. It retrieves values for each of the settings: query, fields, maxResults, and nextToken, prioritizing user inputs over default settings.
  3. A validation check is performed to ensure that the query is provided. If not, it returns an error indicating that a search query is required.
  4. The logic then builds a connection instance using a secure connection, passing it the context.
  5. The integration attempts to search for recent tweets using the specified parameters:
    • query: The search term.
    • fields: The fields of data to return.
    • maxResults: The maximum number of tweets to fetch.
    • nextToken: Optional token for pagination.
  6. If successful, it captures the data and returns it in a structured format. If there is an error during the integration call, it provides a relevant error message.

Data Expectations

The searchTweets component expects the following data inputs:

Use Cases & Examples

Use Case 1: Social Media Monitoring

A marketing team can use the searchTweets component to track mentions of their brand on Twitter and assess public sentiment over time.

Use Case 2: Event Tracking

An event organizer can leverage the component to fetch real-time tweets during an unfolding event (e.g., a conference or concert) to analyze attendee feedback.

Use Case 3: Trend Analysis

Data analysts may wish to examine recent tweets concerning specific hashtags to identify trending topics and sentiment.

Example Configuration

For the Event Tracking use case, a configuration might look like this:

json
{
    "inputs": {
        "query": "#VantageConference",
        "fields": ["id", "text", "created_at", "author_id"],
        "maxResults": 20,
        "nextToken": undefined
    },
    "config": {}
}

In this example, the component is set to search for tweets with the hashtag #VantageConference, returning the tweet ID, text, creation date, and author ID, with a limit of 20 results.