Skip to content
← Public packages

@kentcdodds/x

X API v2 helpers for tweets, search, legacy DMs, and encrypted X Chat via a Fly XDK sidecar.

  • Integrations
  • x
  • twitter
  • social
  • oauth
  • posting
  • search
  • dm
  • chat
  • openapi
  • multi-account
Version
2.4.3
License
MIT
Published
September 11, 2026
Pinned commit
79bc950
Rating
No ratings yet
Forks
2
Adaptation effort
—

@kentcdodds/x

Intent

Headless X API v2 helpers for Kody agents: OpenAPI-scaffolded bearer-token reads (xBearerToken), multi-account OAuth user-context requests via saved x / x-* integrations, search/profile/tweet helpers with tweet shaping and rate-limit notes, guarded social actions, legacy direct messages, and on-demand encrypted X Chat (list threads, read a thread, send a message) via a Fly XDK sidecar that unlocks the existing Chat identity with xChatPin. Not a 24/7 bot or Activity stream. Meant to be forked: call ./adapt to swap the Fly sidecar, secrets, and OAuth account onto the forking user, then rewrite this Intent and publish their copy.

What it does

  • App-only bearer reads: username lookup, recent search, public user tweets
  • Multi-account OAuth: authenticated profile, posts, likes, reposts, bookmarks, follows
  • Legacy DMs: list events, read a conversation, send (guarded)
  • Encrypted X Chat via Fly XDK sidecar: list inbox metadata, decrypt a thread, send ciphertext (guarded)
  • Token refresh for a selected x / x-* integration
  • Fork adapt guide and sidecar source for deploying your own Fly app

Prerequisites / setup

  1. Save user secret xBearerToken (app-only bearer). Approve host api.x.com if prompted.
  2. Connect OAuth integration x (default). Optional accounts: x-<purpose> (for example x-kodykoala). Reconnect at https://kody.codes/connect/oauth?provider=x or ...?provider=x-<purpose>.
  3. For encrypted X Chat (needs OAuth dm.read / dm.write plus sidecar):
    • User secrets xChatPin (existing x.com Chat PIN — never generate a new keypair) and xChatSidecarToken (shared bearer for your Fly sidecar)
    • Package storage xChatSidecarUrl — your Fly origin (forks must set this; the listing default is the author’s sidecar)
    • Host-approve only your sidecar host on those secrets — not Juicebox or api.x.com for the PIN
  4. Agents: see AGENTS.md for import paths, smoke/dryRun snippets, and fork adapt steps.

Multi-account: omit account → integration x; account: 'kodykoala' → x-kodykoala; or pass integration: 'x-kodykoala' exactly.

Done when

  • xBearerToken is saved; OAuth x (and any x-*) connected as needed
  • Bearer smoke returns ok: true (HTTP 429 counts as auth-plumbing-verified)
  • Write helpers return dry-run unless confirm: true after explicit approval
  • Chat (if used): sidecar URL stored, PIN/token secrets approved for your sidecar host only; list/get chat work without generating a new identity
Report this listing

Log in to report this listing.