X (Twitter)
Post X, balasan, like, repost, DM dan unggah media (X menagih per request)
Beta v0.2.0 Node.js 21 aksi Risiko ToS sedang
Tentang
Plugin Graphrt untuk X API v2 resmi. Plugin ini menerbitkan dan mengelola post, membaca mention dan balasan, like dan repost, memoderasi balasan, mengirim direct message dan mengunggah gambar, semuanya sebagai user pemilik access token OAuth 2.0. Setiap operasi adalah node workflow. Tool agent dibatasi oleh kebijakan agent.
Yang bisa dilakukan
- Users: the authenticated user, lookup by username
- Posts: create (text, reply, quote, up to 4 media, poll, reply settings), delete, read, list a user's posts, list mentions, recent search (last 7 days)
- Replies and engagement: list a conversation's replies, hide/unhide replies, like/unlike, repost/undo
- Direct messages: list DM events, read one conversation, send a DM (text and/or image), start a group DM
- Media: upload_media downloads an image from an https URL on a public host (up to 5 MB, every redirect hop must stay https and public) and uploads it
- Tokens: refresh_access_token, which is node only and never offered to agents (X rotates refresh tokens, so the new one is returned)
- api_request: any other X API v2 endpoint, restricted to api.x.com
- Retries rate limits using x-rate-limit-reset, and gives clear error kinds. Tokens never appear in errors.
Aksi
Setiap aksi adalah langkah yang bisa ditambahkan ke workflow. Agent juga bisa memakai sebagian besar aksi sebagai tool.
- Get my X profile
x-api.get_me - Get X user by username
x-api.get_user_by_username - Create X post
x-api.create_post - Delete X post
x-api.delete_post - Get X post
x-api.get_post - List X user posts
x-api.list_user_posts - List X mentions
x-api.list_mentions - Search recent X posts
x-api.search_recent_posts - List X replies
x-api.list_replies - Hide/unhide X reply
x-api.hide_reply
Tampilkan semua 21 aksi
- Like X post
x-api.like_post - Unlike X post
x-api.unlike_post - Repost X post
x-api.repost - Undo X repost
x-api.undo_repost - List X DM events
x-api.list_dm_events - List X DM conversation
x-api.list_dm_conversation_events - Send X DM
x-api.send_dm - Create X group DM
x-api.create_group_dm - Upload X image
x-api.upload_media - Refresh X access token
x-api.refresh_access_token - X API request
x-api.api_request
Pengaturan
Graphrt menyalakan plugin dengan environment yang bersih. Hanya nilai ini yang sampai ke plugin, dan secret tidak masuk log.
-
X_ACCESS_TOKENYes, except for refresh_access_tokenOAuth 2.0 user access token (expires after 2 hours) -
X_USER_IDOpsionalYour numeric user id. If it's unset, operations that need it (likes, reposts, your posts and mentions) call GET /2/users/me once per run, which is one extra billed user read. -
X_REFRESH_TOKENOpsionalDefault refresh token for refresh_access_token -
X_CLIENT_IDOpsionalDefault OAuth 2.0 client id for refresh_access_token -
X_TOOL_ALLOW_POSTOpsional1 lets agent tools publish: create_post (posts, replies, quotes), repost, undo_repost -
X_TOOL_ALLOW_ENGAGEOpsional1 lets agent tools like_post, unlike_post and hide_reply -
X_TOOL_ALLOW_DMOpsional1 lets agent tools send_dm and create_group_dm, to recipients in X_TOOL_RECIPIENT_ALLOWLIST only -
X_TOOL_RECIPIENT_ALLOWLISTWith X_TOOL_ALLOW_DMComma-separated user ids (and, for send_dm with conversation_id, conversation ids) agent tools may message, matched exactly. Unset refuses every agent DM -
X_CLIENT_SECRETOpsionalClient secret for confidential apps, used by refresh_access_token (Basic auth). Public PKCE apps leave it unset. -
X_API_TOOL_TOKEN_SOURCE
Cara memakainya
Di Graphrt Desktop
- Buka Plugins dan cari X (Twitter).
- Klik Install lalu setujui.
- Ikuti langkah setup di halaman plugin, lalu tempel pengaturan yang dibutuhkan.
- Jelaskan pekerjaan yang membutuhkannya, dan builder menambahkan langkahnya.
Dengan CLI
terminal
$ graphrt plugin install x-api workflow.yaml
- id: image
type: x-api.upload_media
image_url: "https://example.com/launch.png"
- id: post
type: x-api.create_post
text: "We just launched!"
media_ids: ["{{#image.data.data.id#}}"]
- id: thanks
type: x-api.send_dm
participant_id: "{{#start.user_id#}}"
text: "Thanks for the feedback!"