Install
$ agentstack add skill-fa0311-twitter-api-safe-relay-skills-twitter-api-relay ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
twitter-api-relay
Turn a Twitter instruction into the right relay call, run it, and report the answer — not raw JSON.
The relay speaks Twitter's own private GraphQL + v1.1 API. Two files matter:
- This file — how to call, and the non-obvious knowledge the catalog can't tell you.
requests.ndjson(same dir) — what you can call: one operation per line, each with a real example. It is swapped out mechanically, so re-read it every time — never copy its values into this file.
Setup: base URL is $TWITTER_RELAY_BASE_URL (e.g. http://localhost:6900/); ask the operator if unset. No auth needed — the relay is already signed in as one account (call Viewer to see who). Responses are JSON.
The flow
- Find the operation. Scan
requests.ndjsonfor the line whose operation name (the tail ofpath) matches the intent — infer from the name. - Copy that line, change only what the intent requires (
screen_name/rawQuery/count/cursor…). Leavefeatures,fieldToggles,queryIdexactly as shipped — they are version locks, not knobs. - Use that line's own variable keys — never guess from another operation. A tweet is
focalTweetIdinTweetDetail,tweetIdinRetweeters,timelineIdinGenericTimelineById. Same concept, different keys. - Resolve IDs first. Most ops want an internal id, not an @handle. Map handle → id with
UserByScreenName(.data.user.result.rest_id), then make the real call.typeahead.json(setq=,result_type=users) is a faster fuzzy resolver — it returnsid_strdirectly. - Summarize the answer and paginate with
cursorif more is needed.
Building the URL
The prefix depends on the API, and a wrong prefix is a silent 404. Base is $TWITTER_RELAY_BASE_URL (treat as no trailing slash).
| path looks like | URL is | Auth example | |---|---|---| | /graphql/… (GraphQL) | base + /i/api + path | …/i/api/graphql/…/SearchTimeline | | /1.1/….json or /2/… (REST) | base + path — no /i/api | …/1.1/search/typeahead.json |
B="${TWITTER_RELAY_BASE_URL%/}"
# GraphQL GET — variables/features/fieldToggles are already JSON strings; edit contents only, pass verbatim
curl -sS -G "$B/i/api" --data-urlencode 'variables=' --data-urlencode 'features='
# GraphQL POST / any write — send the whole data object as one JSON body
curl -sS "$B/i/api" -H 'content-type: application/json' --data ''
# v1.1 / v2 REST — same shapes but NO /i/api prefix
curl -sS -G "$B" --data-urlencode 'q='
curl -sS "$B" -H 'content-type: application/json' --data ''
Reading responses with jq
Responses are 100 KB+ timeline payloads, and the wrapper path differs per operation (search_by_raw_query.search_timeline…, user.result.timeline_v2…, threaded_conversation…). So don't hardcode paths — recurse with .. and one filter works everywhere. Fields also moved around over time (tweet text + counts live in a legacy object; the author's handle/name live in a separate core object) — recursion sidesteps all of that.
# Tweets, ranked by engagement (text + counts come together)
curl … | jq -c '[.. | objects | select(.full_text?)
| {text:.full_text, likes:.favorite_count, rts:.retweet_count, replies:.reply_count, at:.created_at}]
| sort_by(-.likes) | .[:10]'
curl … | jq -r '[.. | objects | select(.screen_name?) | .screen_name] | unique' # every @handle present
curl … | jq -r 'first(.. | objects | select(.cursorType?=="Bottom") | .value)' # next-page cursor → feed back into `cursor`
curl … | jq -r '.data.user.result.rest_id' # UserByScreenName → userId
HTTP 200 ≠ success. GraphQL puts failures in the body, not the status code — check jq '.errors' before trusting a read.
Searching well
Search is the highest-leverage read, and two things unlock it — neither is obvious from the example line (which ships product:"Media", just one tab):
product picks the tab (it's a variable):
Top— ranked / popular → 話題の・バズっているツイート. The one you usually want.Latest— reverse-chronological, for real-time monitoring.People— accounts ·Media— photos/videos.
rawQuery is the literal search box, so the full advanced-search grammar works (space-separated, combine freely):
from:user to:user since:YYYY-MM-DD until:YYYY-MM-DD
min_faves:N min_retweets:N min_replies:N
filter:media|links|verified|follows -filter:replies
lang:ja "exact phrase" a OR b #tag url:domain
> Trending on a topic = product:"Top" + an engagement floor in the query: > {"rawQuery":"AI min_faves:500 lang:ja since:2026-06-01", "product":"Top", …} > (min_faves goes inside rawQuery; product is a separate variable.)
Writes
Side-effecting ops (create/delete tweet, follow, like, bookmark, list edits…) — confirm with the user before running. POST alone doesn't mean write: HomeTimeline / HomeLatestTimeline are POST reads.
v1.1 writes (friendships, blocks, mutes…) want a JSON body — form-encoding 500s.
Don't trust a write's response — verify with a read. Write replies are thin or stale:
DeleteTweetreturns{"data":{"delete_tweet":{"tweet_results":{}}}}— empty, not a confirmation.CreateTweetdoes return the new id at.data.create_tweet.tweet_results.result.rest_id.friendships/createanddestroyecho thefollowingstate from before the call (verified: follow→following:false, unfollow→following:true). Useless as confirmation — re-read the relationship instead (whatever the catalog offers, e.g.Following).
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: fa0311
- Source: fa0311/twitterapisaferelay_skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.