Skip to content

emusksReverse-engineered Twitter API client

Log in and interact with the unofficial X & XChat APIs using any client identity.

TIP

Are you an LLM? Please read our llms.txt or llms-full.txt.

Quick start

Install the package and start interacting with Twitter in just a few lines:

sh
bun add emusks
js
import Emusks from "emusks";

const client = new Emusks();
await client.login("your_auth_token");

const tweet = await client.tweets.create("hallo from emusks! 🚀");
console.log(`i tweeted to https://x.com/i/status/${tweet.id}`);

// like the tweet
await client.tweets.like(tweet.id);

// get a user
const user = await client.users.getByUsername("elonmusk");
console.log(`${user.name} has ${user.stats.followers.count} followers`);

// follow them
await client.users.follow(user.id);

// search for tweets
const results = await client.search.tweets("javascript");

// get your home timeline
const home = await client.timelines.home();

// send an end-to-end encrypted XChat DM, in one call
await client.xchat.createIdentity({ pin: "2468" }); // once; persist it and loadIdentity() next time
await client.xchat.message(user.id, "this is end-to-end encrypted ^w^");

not affiliated with X Corp.