> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jinba.io/llms.txt
> Use this file to discover all available pages before exploring further.

# X (Twitter)

> Interact with X (Twitter) API - post tweets, get user profiles, and search tweets

## Overview

X (Twitter) tools allow you to interact with the X platform API to post tweets, retrieve user profiles, search for tweets, and get specific tweet information. These tools provide comprehensive social media integration capabilities.

## Key Features

* `X_POST`: Post tweets to your X account
* `X_GET_USER_PROFILE`: Retrieve user profile information
* `X_SEARCH_TWEETS`: Search for tweets using queries
* `X_GET_TWEETS`: Get specific tweets by ID or criteria

## Authentication

To use the X API, you need to create a developer account on the [X Developer Platform](https://developer.x.com/) and generate your API keys.

* `X_POST` uses OAuth 1.0a user-context credentials (config): `consumer_key`, `consumer_secret`, `access_token`, `access_token_secret`
* `X_GET_USER_PROFILE`, `X_SEARCH_TWEETS`, and `X_GET_TWEETS` use an app-only OAuth 2.0 Bearer token (config): `bearer_token`

**Note**: Treat API keys as sensitive information and never commit them to public repositories.

## Tools

### X\_POST

Post tweets to your X account.

**Input**:

| Parameter    | Type   | Required | Description           |
| ------------ | ------ | -------- | --------------------- |
| `tweet_text` | string | Yes      | The text of the tweet |

**Output**:

| Field        | Type   | Description              |
| ------------ | ------ | ------------------------ |
| `tweet.id`   | string | ID of the posted tweet   |
| `tweet.text` | string | Text of the posted tweet |

### X\_GET\_USER\_PROFILE

Retrieve user profile information from X.

**Input**:

* `username` (string, required): Username to lookup (without @)

**Output**:

A `user` object with `id`, `username`, `name`, and (when available) `description`, `location`, `url`, `verified`, `followers_count`, `following_count`, `tweet_count`, `created_at`, and `profile_image_url`.

### X\_SEARCH\_TWEETS

Search for tweets using specific queries.

**Input**:

| Parameter          | Type    | Required | Description                                                              |
| ------------------ | ------- | -------- | ------------------------------------------------------------------------ |
| `query`            | string  | Yes      | Search query                                                             |
| `count`            | number  | No       | Number of tweets to retrieve (1-100, default: 10)                        |
| `result_type`      | string  | No       | Type of results: `recent`, `popular`, `mixed` (default: `recent`)        |
| `include_entities` | boolean | No       | Include entities such as hashtags, mentions, and URLs (default: `false`) |

**Output**:

A `tweets` array. Each tweet has `id`, `text`, `created_at`, `author`, and optional `public_metrics` (`retweet_count`, `like_count`, `reply_count`) and `entities` (`hashtags`, `mentions`, `urls`).

### X\_GET\_TWEETS

Retrieve recent tweets from a user's timeline.

**Input**:

| Parameter          | Type    | Required | Description                                        |
| ------------------ | ------- | -------- | -------------------------------------------------- |
| `username`         | string  | Yes      | Twitter username (without @)                       |
| `count`            | number  | No       | Number of tweets to retrieve (1-100, default: 10)  |
| `include_replies`  | boolean | No       | Include replies in the results (default: `false`)  |
| `include_retweets` | boolean | No       | Include retweets in the results (default: `false`) |

**Output**:

A `tweets` array. Each tweet has `id`, `text`, `created_at`, `author` (`username`, `name`), and optional `public_metrics` (`retweet_count`, `like_count`, `reply_count`).

## Examples

### Example: Post a Tweet

```yaml theme={null}
- id: post_tweet
  tool: X_POST
  config:
    - name: consumer_key
      value: "{{secrets.TWITTER_CONSUMER_KEY}}"
    - name: consumer_secret
      value: "{{secrets.TWITTER_CONSUMER_SECRET}}"
    - name: access_token
      value: "{{secrets.TWITTER_ACCESS_TOKEN}}"
    - name: access_token_secret
      value: "{{secrets.TWITTER_ACCESS_TOKEN_SECRET}}"
  input:
    - name: tweet_text
      value: "Hello from Jinba Flow! 🚀"
```

### Example: Get User Profile

```yaml theme={null}
- id: get_profile
  tool: X_GET_USER_PROFILE
  config:
    - name: bearer_token
      value: "{{secrets.TWITTER_BEARER_TOKEN}}"
  input:
    - name: username
      value: "jinbaflow_JP"
```

### Example: Search Tweets

```yaml theme={null}
- id: search_tweets
  tool: X_SEARCH_TWEETS
  config:
    - name: bearer_token
      value: "{{secrets.TWITTER_BEARER_TOKEN}}"
  input:
    - name: query
      value: "workflow automation"
    - name: count
      value: 20
```

### Example: Get a User's Tweets

```yaml theme={null}
- id: get_tweets
  tool: X_GET_TWEETS
  config:
    - name: bearer_token
      value: "{{secrets.TWITTER_BEARER_TOKEN}}"
  input:
    - name: username
      value: "jinbaflow_JP"
    - name: count
      value: 10
    - name: include_retweets
      value: false
```

## Use Cases

* Social media automation and scheduling
* Social listening and brand monitoring
* Customer engagement and support
* Content amplification and marketing
* Real-time trend analysis
* Community management
