A CLI tool for generating and posting tweets using LLMs and the Twitter/X API
Project description
Birdapp: a Twitter/X CLI tool
A command-line tool for posting tweets to Twitter/X from the command line.
Setup
This repo uses the uv package manager to manage dependencies. If you don't already have uv installed, you can install it with the following curl command:
curl -LsSf https://astral.sh/uv/install.sh | sh
To verify install, use:
uv --version
Consult the uv installation docs for more detailed instructions and troubleshooting.
Installation
You can install the CLI tool globally using uv:
uv tool install -U git+https://github.com/Promptly-Technologies-LLC/birdapp.git
After installation, you can use:
birdapp auth config
birdapp tweet --text "Hello world!"
Configuration
Getting Twitter API Credentials
Before you can use the CLI, you need to configure your Twitter API credentials. To do this, you need to sign up for a Twitter/X developer account.
In the dashboard, you will need to create an application. Make sure your application has "Read and Write" permissions. From your application's "Keys and Tokens" section in the developer dashboard, generate:
- API Key
- API Secret
- Access Token
- Access Token Secret
Profiles
Birdapp stores credentials by username profile. Each profile is keyed by the X username
(without @).
How profiles are created:
- OAuth1: created when you run
birdapp auth config --oauth1and enter a username. - OAuth2: created when you run
birdapp auth login(the username comes from the login).
How profiles are selected:
- The active profile is set by
birdapp profile use <username>. --profile <username>overrides the active profile for a single command.
Commands:
birdapp auth config --oauth1 # creates/updates profile after you enter a username
birdapp auth config --oauth2 # configures shared OAuth2 app credentials
birdapp auth login # creates/updates profile after OAuth2 login
birdapp profile list
birdapp profile use yourusername
birdapp profile show yourusername
Setting Up Credentials
Run the configuration command to set up your credentials:
birdapp auth config --oauth1 # or --oauth2
Required:
- OAuth1: run
birdapp auth config --oauth1per profile. - OAuth2: run
birdapp auth config --oauth2once, thenbirdapp auth loginper account. - Choose OAuth1 or OAuth2 based on your app registration and security posture.
Optional:
- Use
--profile <username>to configure a specific profile without switching.
This will prompt you for your Twitter API credentials and store them securely in
~/.config/birdapp/config.json.
To view your current configuration (without showing secrets):
birdapp auth config --show
Auth Flows
Birdapp supports both OAuth1 and OAuth2. Choose based on your security posture and how your X app is registered.
OAuth1:
- Required:
birdapp auth config --oauth1 - Optional: None (no separate login step)
- Stores app key/secret and user access token/secret locally.
- Best when you want direct user tokens and minimal steps.
OAuth2 (Authorization Code with PKCE):
- Required:
birdapp auth config --oauth2(app config), thenbirdapp auth login(profile creation) - Optional:
birdapp auth whoamito verify the token - Tokens are stored per profile and user id (multiple accounts supported).
auth whoamiuses the active profile unless--profileor--user-idis provided.- If
X_OAUTH2_CLIENT_SECRETis set, the client behaves as confidential; otherwise it uses public PKCE and avoids storing an app secret. The user experience is the same for both flows, but you may need to use the confidential flow if you registered your app as confidential.
OAuth2 (User Context)
OAuth2 uses Authorization Code with PKCE. Configure these environment variables:
X_OAUTH2_CLIENT_IDX_OAUTH2_REDIRECT_URI(must match your app's callback URL)X_OAUTH2_SCOPES(optional, default:tweet.read users.read offline.access)X_OAUTH2_CLIENT_SECRET(optional, only for confidential clients)
You can set these via the config workflow:
birdapp auth config --oauth2
Required:
birdapp auth config --oauth2(shared app config)birdapp auth login(creates the profile and stores tokens)
Optional:
birdapp auth whoami
To authenticate and store a token:
birdapp auth login
To verify the token:
birdapp auth whoami
For development fixture capture:
uv run tests/capture_oauth2_fixtures.py
Usage
Posting Tweets
To post a tweet:
birdapp tweet --text "Your tweet content here"
To post a tweet with media:
birdapp tweet --text "Check out this image!" --media /path/to/image.jpg
To post a media-only tweet (no text):
birdapp tweet --media /path/to/image.jpg
Replying to Tweets
To reply to a tweet using its ID:
birdapp tweet --text "Great point!" --reply-to 1234567890
To reply to a tweet using its URL:
birdapp tweet --text "I agree!" --reply-to "https://x.com/user/status/1234567890"
You can also include media in replies:
birdapp tweet --text "Here's my response" --media /path/to/image.jpg --reply-to 1234567890
Getting Tweets
To retrieve tweets by ID (up to 100 at a time):
birdapp get 1234567890
birdapp get 1234567890 9876543210 --format detailed
birdapp get 1234567890 --json
Looking Up Users
To look up users by username or ID (up to 100 at a time):
birdapp user elonmusk
birdapp user @nasa @spacex
birdapp user 44196397 --by-id
birdapp user elonmusk --format detailed --fields public_metrics created_at
Importing your tweets from the Twitter Community Archive
If you have shared your tweets with the public via the Twitter Community Archive, you can download them from the archive and import them into a SQLite database for local search and analysis:
birdapp import-archive --username yourusername
If you've already downloaded your archive.json file, you can import it from a local file:
birdapp import-archive --path /path/to/archive.json
Help
To see all available commands:
birdapp --help
To see help for a specific command:
birdapp tweet --help
birdapp auth --help
birdapp get --help
birdapp user --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file birdapp-1.1.0.tar.gz.
File metadata
- Download URL: birdapp-1.1.0.tar.gz
- Upload date:
- Size: 71.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56a2f62fb89a410568272b778f3f99b5820dcadce219e574ce47f19153214ad3
|
|
| MD5 |
65c40b8989851d7c1d7bf9ee3977a9ce
|
|
| BLAKE2b-256 |
f0eea61f729e1c2c158f6028aa86bb00171eebdd39940ef847bbc9035ab03a0c
|
Provenance
The following attestation bundles were made for birdapp-1.1.0.tar.gz:
Publisher:
release.yml on Promptly-Technologies-LLC/birdapp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
birdapp-1.1.0.tar.gz -
Subject digest:
56a2f62fb89a410568272b778f3f99b5820dcadce219e574ce47f19153214ad3 - Sigstore transparency entry: 844896741
- Sigstore integration time:
-
Permalink:
Promptly-Technologies-LLC/birdapp@3231f12ac450449e583cf064f20e3b06cbf79cf8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Promptly-Technologies-LLC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3231f12ac450449e583cf064f20e3b06cbf79cf8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file birdapp-1.1.0-py3-none-any.whl.
File metadata
- Download URL: birdapp-1.1.0-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7322415326177091fcf0a90688ce56314a433a568573283ec860880673f87513
|
|
| MD5 |
b8c5b3ff5c0ce9f326a427984817e67d
|
|
| BLAKE2b-256 |
7aceedd3f6b72a0499377637ffc303d7edccf0e6b1b0367a6cf63d84998f77b8
|
Provenance
The following attestation bundles were made for birdapp-1.1.0-py3-none-any.whl:
Publisher:
release.yml on Promptly-Technologies-LLC/birdapp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
birdapp-1.1.0-py3-none-any.whl -
Subject digest:
7322415326177091fcf0a90688ce56314a433a568573283ec860880673f87513 - Sigstore transparency entry: 844896745
- Sigstore integration time:
-
Permalink:
Promptly-Technologies-LLC/birdapp@3231f12ac450449e583cf064f20e3b06cbf79cf8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Promptly-Technologies-LLC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3231f12ac450449e583cf064f20e3b06cbf79cf8 -
Trigger Event:
push
-
Statement type: