Skip to main content

Prerequisites

Set up an X developer account and obtain the necessary keys. Follow the steps:
(Click for step details)
  • Go to the X Developer website: https://developer.x.com/
  • Sign in with your X account or create a new one if you don’t have an account.
  • Apply for a developer account by providing the required information about your intended use of the X API.
  • Once your developer account is approved, log in to the X Developer portal.
  • Navigate to the “Projects & Apps” section and create a new project.
  • Within the project, create a new app. This app will be used to generate the necessary API keys and tokens.
  • You’ll get a client id and client secret, but you can ignore them.
  • After creating the app, navigate to the “Keys and tokens” tab.
  • Generate the following keys, tokens, and client credentials:
    • API Key (Consumer Key)
    • API Secret Key (Consumer Secret)
    • Bearer Token
    • Access Token
    • Access Token Secret
Export the generated keys, tokens, and client credentials as environment variables in your system or provide them as arguments to the XTools constructor.
  • X_CONSUMER_KEY
  • X_CONSUMER_SECRET
  • X_ACCESS_TOKEN
  • X_ACCESS_TOKEN_SECRET
  • X_BEARER_TOKEN

Run the Example

For details, see X tools cookbook.