> For the complete documentation index, see [llms.txt](https://docs.chaingpt.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chaingpt.org/dev-docs-b2b-saas-api-and-sdk/agenticos-framework-web3-ai-agent-on-x-open-source/twitter_developer_account_setup.md).

# Twitter\_Developer\_Account\_Setup

🔑 Twitter API Setup Guide (OAuth 2.0)

To run this application, you’ll need to obtain Twitter API credentials using **OAuth 2.0**. Follow the steps below to generate your **Client ID** and **Client Secret**.

***

#### 🔗 Twitter Developer Portal

➡ **Link:** <https://developer.twitter.com/en/portal/dashboard>

***

#### ✅ Step-by-Step Instructions

1. **Log in to the Twitter Developer Portal**

   Go to the [Twitter Developer Dashboard](https://developer.twitter.com/en/portal/dashboard) and sign in with your Twitter account.
2. **Create a New Project & App**
   * Navigate to: `Projects & Apps > Overview`
   * Click **"Create App"**
   * Provide an app name and select **OAuth 2.0** as the authentication method
3. **Configure OAuth 2.0 Settings**
   * Go to your app's **Settings** tab
   * Under **OAuth 2.0**, configure:
   * **Callback URL:**\
     `https://your-domain.com/api/login/callback` — *Replace `your-domain.com` with your actual domain. It must match exactly as configured in the Twitter Developer Portal.*
     * **Website URL:**\
       `https://your-deployment-url.com`
     * **Client Type:** Confidential
     * **Scopes (Permissions):**
       * `tweet.read`
       * `tweet.write`
       * `users.read`
       * `offline.access` *(required for refresh tokens)*
   * Save the changes.
4. **Generate OAuth 2.0 Credentials**
   * Navigate to the **Keys and Tokens** tab
   * Click **"Generate"** under **OAuth 2.0 Client ID and Client Secret**
   * Copy and store the credentials securely.

***

#### 🧪 Add to Environment Variables

* Paste your credentials in the `.env` file like you
* During one-click deployment, you'll be asked to enter these credentials as environment variables.

below:

```
TWITTER_CLIENT_ID=your_client_id_here
TWITTER_CLIENT_SECRET=your_client_secret_here
```

### Tweet Character Limits

When using this tool to post tweets via the Twitter (X) API, please note:

* **Free Twitter/X Users** are limited to **280 characters per tweet**.
* If you attempt to tweet more than 280 characters from a free account, the request will **fail**.
* To unlock longer tweet capabilities (up to 4,000 characters), users must upgrade to **Twitter Blue (X Premium)**.

👉 You can upgrade or learn more here: <https://x.com/i/premium_sign_up>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chaingpt.org/dev-docs-b2b-saas-api-and-sdk/agenticos-framework-web3-ai-agent-on-x-open-source/twitter_developer_account_setup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
