⚡ XActions
⚡ Examples

Runnable examples

8 Node.js programs built on the XActions library. Every one runs against the live API and was verified before release. 5 of them need no account at all.

Run them

git clone https://github.com/nirholas/XActions.git
cd XActions
npm install
node examples/01-profile-lookup.js

That last command needs no API key, no account, and no browser.

The examples

Profile lookup Fetch a public X profile. No account, no API key, no browser. no login 01-profile-lookup.js User timeline and engagement stats Stream a public timeline and summarise what actually performs. No account needed. no login 02-user-timeline.js Sentiment report for an account Pull a public timeline and score how the account talks. The analyzer is rule-based and runs entirely offline, so this costs nothing and needs no model, no key, and no network beyond the timeline fetch itself. no login 03-sentiment-report.js One account, three networks Look up the same brand on X, Bluesky, and Mastodon and print the results side by side. All three reads are public: no account on any network. no login 04-cross-platform.js Export followers to CSV Page through a follower list and write a spreadsheet-ready CSV. Requires a logged-in session: X does not serve follower lists to guests. login 05-export-followers.js Who doesn't follow you back The set difference that XActions is best known for, done with the HTTP client instead of a browser. Requires a logged-in session. login 06-find-non-followers.js Watch a keyword and alert on it Poll X search on an interval, score each new post for sentiment, and fire a webhook when something negative shows up. This is the shape of a brand monitor, a support-mention watcher, or an incident tripwire. login 07-keyword-monitor.js Drive the MCP server the way an AI agent does Claude, Cursor, and Windsurf talk to XActions over MCP: they spawn the server, exchange JSON-RPC over stdio, and call tools. This example does exactly that, in about 60 lines, so you can see the wire format and verify your setup without an AI client in the loop. no login 08-mcp-tool-call.js

What needs a login, and why

X splits its internal API into two tiers. Profiles and public user timelines are served to anyone. Search, followers, following, likes, bookmarks, and DMs require a logged-in session, and X answers a logged-out request to one of those with a bare 404.

The examples that need a session check for one up front and print setup instructions rather than failing halfway through. See Configuration for how to supply auth_token and ct0.

Want the guided version?

The tutorials walk through this material step by step, with the reasoning behind each decision.

Read the tutorials