A lightweight CLI tool and opencode skill for managing your Threads.com account via the Meta Graph API.
Zero dependencies. Pure Bash + curl + jq.
| Feature | Description |
|---|---|
| Profile | View your account info |
| Posts | List, get, and create posts (text & image) |
| Replies | Read and send replies |
| Insights | Engagement metrics (views, likes, reposts, etc.) |
| Mentions | Posts where you're tagged |
| Search | Keyword search across public posts |
| Moderation | Hide/unhide replies |
# Project-level (recommended)
git clone https://github.com/mrhustlex/threads-api-cli-skills.git .opencode/skills/threads-manager
# Or global
git clone https://github.com/mrhustlex/threads-api-cli-skills.git ~/.config/opencode/skills/threads-managerThen restart opencode. The skill auto-triggers on threads-related queries.
See CONTRIBUTING.md for other install methods.
git clone https://github.com/mrhustlex/threads-api-cli-skills.git
cd threads-api-cli-skills
./scripts/setup.sh # interactive setup wizard
./scripts/threads.sh profile./scripts/setup.shThe wizard will:
- Show step-by-step instructions to get a token from Graph API Explorer
- Ask you to paste the token (only in terminal, never in chat)
- Validate the token against the API
- Auto-detect your user ID
- Write
.envwith secure permissions (600)
Click to expand
Step 1 — Create a Meta App
- Go to developers.facebook.com → My Apps → Create App
- Select Business → name your app → Create App
- In the sidebar, click Add Use Case → select Threads → Add
Step 2 — Generate an Access Token
- Open Graph API Explorer
- Select your app from the dropdown
- Click Generate Access Token
- Check all permissions:
threads_basicthreads_content_publishthreads_manage_insightsthreads_manage_repliesthreads_read_repliesthreads_manage_mentionsthreads_keyword_search
- Authorize with your Threads account
- Copy the token
Step 3 — Get Your User ID
curl -s "https://graph.threads.net/v1.0/me?fields=id,username&access_token=YOUR_TOKEN"Step 4 — Configure .env
cp .env.example .env
# Edit with your token and user ID./scripts/threads.sh <command> [args]| Command | Example | Description |
|---|---|---|
profile |
./scripts/threads.sh profile |
View your profile |
posts |
./scripts/threads.sh posts 5 |
List posts (default: 10) |
thread |
./scripts/threads.sh thread <id> |
Get a specific post |
create |
./scripts/threads.sh create "Hello!" |
Create a text post |
create |
./scripts/threads.sh create "Hi" "https://img.jpg" |
Create an image post |
replies |
./scripts/threads.sh replies <id> |
Get replies to a post |
reply |
./scripts/threads.sh reply <id> "Nice!" |
Reply to a post |
insights |
./scripts/threads.sh insights <id> |
Get engagement metrics |
mentions |
./scripts/threads.sh mentions |
Get posts mentioning you |
search |
./scripts/threads.sh search "AI" |
Search by keyword |
hide |
./scripts/threads.sh hide <reply_id> |
Hide a reply |
unhide |
./scripts/threads.sh unhide <reply_id> |
Unhide a reply |
Valid metrics: views · likes · replies · reposts · quotes · clicks · shares
Note:
impressionsandreachare not valid for Threads.
| Value | Who can reply |
|---|---|
everyone |
Anyone (default) |
accounts_you_follow |
People you follow |
mentioned_only |
People you @mentioned |
parent_post_author_only |
Author of the parent post |
followers_only |
Your followers |
| Scope | Required for |
|---|---|
threads_basic |
All endpoints (required) |
threads_content_publish |
Creating posts |
threads_manage_insights |
Insights |
threads_manage_replies |
Hide/unhide replies |
threads_read_replies |
Reading reply data |
threads_manage_mentions |
Mentions (needs App Review) |
threads_keyword_search |
Search (needs App Review) |
Note: Mentions and search require App Review approval for non-tester users.
| Limit | Count |
|---|---|
| Posts per 24h | 250 |
| Search queries per 24h | 2,200 |
| Max post length | 500 characters |
| Short-lived token | 1 hour (Graph API Explorer: 60 days) |
| Long-lived token | 60 days |
Graph API Explorer tokens are long-lived (60 days). If you have a short-lived token (1 hour), run:
./scripts/setup.sh # offers to exchange for long-lived tokenTo manually refresh:
- Go to Graph API Explorer
- Select your app
- Generate a new token
- Update your
.env
Check current token status:
./scripts/threads.sh tokenThe Threads API does not support:
- Editing posts
- Deleting posts
See CONTRIBUTING.md for guidelines.
See CODE_OF_CONDUCT.md.