> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/tools/x.md).

# x

[X](https://x.com/) (formerly Twitter) is a popular social media platform that enables real-time communication, content sharing, and engagement with audiences worldwide.

The X integration in Agent Forge leverages OAuth authentication to securely connect with the X API, allowing your agents to interact with the platform programmatically. This OAuth implementation ensures secure access to X's features while maintaining user privacy and security.

With the X integration, your agents can:

* **Post content**: Create new tweets, reply to existing conversations, or share media directly from your workflows
* **Monitor conversations**: Track mentions, keywords, or specific accounts to stay informed about relevant discussions
* **Engage with audiences**: Automatically respond to mentions, direct messages, or specific triggers
* **Analyze trends**: Gather insights from trending topics, hashtags, or user engagement patterns
* **Research information**: Search for specific content, user profiles, or conversations to inform agent decisions

By connecting Agent Forge with X via OAuth, you can build intelligent agents that maintain a consistent and responsive social media presence while adhering to platform policies and API best practices.

## Usage Instructions

Connect with X to post tweets, read content, search for information, and access user profiles. Integrate social media capabilities into your workflow with comprehensive X platform access.

## Tools

### `x_write`

Post new tweets, reply to tweets, or create polls on X (Twitter)

#### Input

| Parameter     | Type   | Required | Description                               |
| ------------- | ------ | -------- | ----------------------------------------- |
| `accessToken` | string | Yes      | X OAuth access token                      |
| `text`        | string | Yes      | The text content of your tweet            |
| `replyTo`     | string | No       | ID of the tweet to reply to               |
| `mediaIds`    | array  | No       | Array of media IDs to attach to the tweet |
| `poll`        | object | No       | Poll configuration for the tweet          |

#### Output

| Parameter      | Type | Description        |
| -------------- | ---- | ------------------ |
| `tweet`        | json | Tweet data         |
| `replies`      | any  | Tweet replies      |
| `context`      | any  | Tweet context      |
| `tweets`       | json | Tweets data        |
| `includes`     | any  | Additional data    |
| `meta`         | json | Response metadata  |
| `user`         | json | User profile data  |
| `recentTweets` | any  | Recent tweets data |

### `x_read`

Read tweet details, including replies and conversation context

#### Input

| Parameter        | Type    | Required | Description                             |
| ---------------- | ------- | -------- | --------------------------------------- |
| `accessToken`    | string  | Yes      | X OAuth access token                    |
| `tweetId`        | string  | Yes      | ID of the tweet to read                 |
| `includeReplies` | boolean | No       | Whether to include replies to the tweet |

#### Output

| Parameter      | Type | Description        |
| -------------- | ---- | ------------------ |
| `tweet`        | json | Tweet data         |
| `replies`      | any  | Tweet replies      |
| `context`      | any  | Tweet context      |
| `tweets`       | json | Tweets data        |
| `includes`     | any  | Additional data    |
| `meta`         | json | Response metadata  |
| `user`         | json | User profile data  |
| `recentTweets` | any  | Recent tweets data |

### `x_search`

Search for tweets using keywords, hashtags, or advanced queries

#### Input

| Parameter     | Type   | Required | Description                                                 |
| ------------- | ------ | -------- | ----------------------------------------------------------- |
| `accessToken` | string | Yes      | X OAuth access token                                        |
| `query`       | string | Yes      | Search query (supports X search operators)                  |
| `maxResults`  | number | No       | Maximum number of results to return (default: 10, max: 100) |
| `startTime`   | string | No       | Start time for search (ISO 8601 format)                     |
| `endTime`     | string | No       | End time for search (ISO 8601 format)                       |
| `sortOrder`   | string | No       | Sort order for results (recency or relevancy)               |

#### Output

| Parameter      | Type | Description        |
| -------------- | ---- | ------------------ |
| `tweet`        | json | Tweet data         |
| `replies`      | any  | Tweet replies      |
| `context`      | any  | Tweet context      |
| `tweets`       | json | Tweets data        |
| `includes`     | any  | Additional data    |
| `meta`         | json | Response metadata  |
| `user`         | json | User profile data  |
| `recentTweets` | any  | Recent tweets data |

### `x_user`

Get user profile information

#### Input

| Parameter     | Type   | Required | Description                            |
| ------------- | ------ | -------- | -------------------------------------- |
| `accessToken` | string | Yes      | X OAuth access token                   |
| `username`    | string | Yes      | Username to look up (without @ symbol) |

#### Output

| Parameter      | Type | Description        |
| -------------- | ---- | ------------------ |
| `tweet`        | json | Tweet data         |
| `replies`      | any  | Tweet replies      |
| `context`      | any  | Tweet context      |
| `tweets`       | json | Tweets data        |
| `includes`     | any  | Additional data    |
| `meta`         | json | Response metadata  |
| `user`         | json | User profile data  |
| `recentTweets` | any  | Recent tweets data |

## Notes

* Category: `tools`
* Type: `x`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://whitepaper.aitech.io/agentforge/tools/x.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.
