npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@socialsforai/sdk

v0.2.1

Published

Typed JavaScript client for the SocialsForAI API: post to X, LinkedIn, Bluesky, Mastodon, Telegram and more from code or AI agents.

Readme

@socialsforai/sdk

A typed JavaScript client for the SocialsForAI API: publish and schedule to X, LinkedIn, Bluesky, Mastodon, Telegram and more with one request, and get a result for every account.

No dependencies. Works anywhere fetch does: Node 18+, Bun, Deno, edge runtimes and browsers. TypeScript types are included.

npm install @socialsforai/sdk

Quickstart

import { SocialsForAI } from "@socialsforai/sdk";

const socials = new SocialsForAI({ apiKey: process.env.SOCIALSFORAI_API_KEY });

// Check first: every network's rules, the exact text each account would get, nothing published.
const check = await socials.posts.create({ accounts: ["linkedin", "bluesky"], text: "We just shipped webhooks.", dry_run: true });
if (!check.ok) console.log(check.issues);

// Publish and wait for the result on every account.
const post = await socials.posts.create({ accounts: ["linkedin", "bluesky"], text: "We just shipped webhooks.", wait: true });
for (const t of post.targets) console.log(t.platform, t.status, t.url);

No key yet? An agent can sign itself up; the client starts using the new key:

const socials = new SocialsForAI();
const ws = await socials.workspaces.create({ name: "My agent", email: "[email protected]" });
// store ws.api_key somewhere safe: it is shown once

Connecting accounts

A person approves each network on its own screen. Create a link, give it to them, and wait:

const link = await socials.connectLinks.create({ platforms: ["x", "linkedin"], external_ref: "client-42" });
console.log("Open this to connect:", link.url);
const result = await socials.connectLinks.waitFor(link.id);

Bluesky, Mastodon, Telegram, Discord, Slack and Nostr can also connect with credentials the owner gives you: socials.accounts.connect({ platform: "bluesky", credentials: { identifier, app_password } }).

Approval before publishing

const post = await socials.posts.create({ accounts: ["acc_..."], text: "Draft for review", approval: "required" });
console.log("Approve here:", post.approval.url);
const decided = await socials.posts.waitForApproval(post.id);
if (decided.approval.status === "rejected") console.log("Feedback:", decided.approval.note);

Editing, deleting, metrics

await socials.posts.update(post.id, { text: "Fixed a typo", scheduled_at: "2026-12-01T09:00:00-08:00" });
await socials.posts.delete(post.id);
const stats = await socials.posts.metrics(post.id);

// What worked over the last 30 days: per account, top posts, best hours in your time zone.
const { top_posts, best_times } = await socials.analytics.get({ days: 30, timezone: "America/New_York" });

Media

const { url } = await socials.media.upload(bytes, "image/png");            // up to 4 MB
const { url: video } = await socials.media.uploadLarge(videoBytes, "video/mp4"); // up to 200 MB
await socials.posts.create({ accounts: ["x"], text: "Look", media: [{ url, alt: "A chart" }] });

Limited keys for other agents

const { key } = await socials.keys.create({
  name: "drafting agent",
  scopes: ["posts:write"],
  account_ids: ["acc_..."],
  require_approval: true,
  daily_post_limit: 5,
});

Errors

Every failure is a SocialsError with a stable code, a message, a fix that says what to do, issues for failed checks, and a requestId:

import { SocialsError } from "@socialsforai/sdk";

try {
  await socials.posts.create({ accounts: ["x"], text: "..." });
} catch (e) {
  if (e instanceof SocialsError) console.error(e.code, e.fix, e.issues);
}

The client retries rate limits (honouring Retry-After), server errors and network failures, up to maxRetries (default 2). posts.create sends an idempotency key automatically, so a retry can never publish twice; pass { idempotencyKey } to make your own retries safe as well. socials.rateLimit holds the latest RateLimit-* values.

Webhooks

import { verifyWebhook } from "@socialsforai/sdk";

// rawBody: the request body exactly as received, before JSON parsing
const ok = await verifyWebhook(process.env.SOCIALS_WEBHOOK_SECRET, req.headers["socials-signature"], rawBody);

Reference

| Area | Methods | | --- | --- | | Workspace | workspaces.create, workspace.get, workspace.update, usage.get, analytics.get, upgradeLinks.create | | Accounts | accounts.list, accounts.get, accounts.connect, accounts.disconnect, connectLinks.create, connectLinks.get, connectLinks.waitFor | | Posts | posts.create, posts.createMany, posts.list, posts.get, posts.update, posts.delete, posts.metrics, posts.replies, posts.waitForApproval | | Events | events.list (what happened since an event id; for clients that can't receive webhooks) | | Media | media.upload, media.createUpload, media.uploadLarge | | Webhooks and keys | webhooks.list, webhooks.create, webhooks.delete, keys.list, keys.create, keys.revoke, verifyWebhook | | Service | platforms.list, health.get |

Full API reference: socialsforai.com/docs · OpenAPI: socialsforai.com/openapi.json

License

MIT