# Search X Posts

{% embed url="<https://www.youtube.com/embed/bOZ2-hWYucs>" %}

## Configuration

### Search Query

Enter the text or keyword phrase you want to search for. You can include variables (e.g., `{{user_input}}`) to make the query dynamic.

**Example:**\
`"fact checking"`

`{{topic}} AND ("AI" OR "machine learning")`

> **Note:** You may include [X advanced search operators](https://developer.twitter.com/en/docs/twitter-api/tweets/search/integrate/build-a-query).

***

### Max Results

Set the maximum number of posts to retrieve. This can range from 10 to 100. Use the slider or type in a number.

***

### After Date *(Optional)*

Return only posts made after a specific date/time. Accepts relative expressions using `{{dateSubtract}}`, `{{currentDate}}`, or static ISO timestamps.

**Example:**

`{{dateSubtract currentDate 3 "days"}}`

This would fetch posts from the last 3 days.

***

### Before Date *(Optional)*

Return only posts made before a specific date/time. Use ISO format (`YYYY-MM-DD HH:mm:ss`).

**Example:**

`2025-07-01 00:00:00`

***

### Output Variable

Specify the variable name where the results will be saved. This variable can be used in later blocks.

**Example:**

`genAIReporting` or `Xpost_results`

## Sample Output

```json
{
  "data": [
    {
      "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "text": "RT @example: Sample tweet text about a topic.",
      "author_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "edit_history_tweet_ids": [
        "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      ]
    },
    {
      "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "text": "RT @example: Sample tweet text about indie games.",
      "author_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "edit_history_tweet_ids": [
        "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      ]
    }
  ],
  "meta": {
    "newest_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "oldest_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "result_count": 2,
    "next_token": "example-token-string"
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://university.mindstudio.ai/docs/building-ai-agents/blocks-reference/search-x-posts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
