The official Node.js / TypeScript SDK. Zero runtime dependencies (native fetch),
Node 18+, ships ESM and CommonJS, fully typed.
Install
Code
npm install @omnisocials/sdk
Authentication
Code
import { OmniSocials } from "@omnisocials/sdk";const client = new OmniSocials({ apiKey: "omsk_live_..." });// or set OMNISOCIALS_API_KEY and call new OmniSocials()
const { data: post } = await client.posts.create({ content: "New drop this Friday", channels: ["instagram", "facebook", "linkedin"], scheduled_at: "2026-08-01T09:00:00Z", media_urls: ["https://example.com/teaser.jpg"],});console.log(post.id, post.status);
Any media_urls (or media_ids) entry can also be an object carrying per-media
alt text (max 1500 chars), delivered to Mastodon, Bluesky, X (photos/GIFs), and
Pinterest:
Code
media_urls: [{ url: "https://example.com/teaser.jpg", alt: "Red sneaker on a white background" }],
Publish immediately:
Code
await client.posts.createAndPublish({ content: "Going live right now", channels: ["x", "bluesky"],});
// From a pathconst res = await client.media.upload({ file: "./photos/product.jpg", name: "product-hero" });// Or from bytes / a Blobimport { readFile } from "node:fs/promises";const bytes = await readFile("./photos/product.jpg");await client.media.upload({ file: bytes, filename: "product.jpg" });
import express from "express";import { verifyWebhookSignature, WebhookVerificationError } from "@omnisocials/sdk";const app = express();app.post( "/omnisocials/webhook", express.raw({ type: "application/json" }), // keep the raw body! (req, res) => { try { const event = verifyWebhookSignature({ payload: req.body, // Buffer of the raw body signature: req.get("X-OmniSocials-Signature") ?? "", secret: process.env.OMNISOCIALS_WEBHOOK_SECRET!, tolerance: 300, // seconds (default) }); switch (event.type) { case "post.published": console.log("Published:", event.data.post_id, event.data.targets); break; case "post.failed": console.error("Failed:", event.data.post_id); break; } res.sendStatus(200); } catch (err) { if (err instanceof WebhookVerificationError) { return res.sendStatus(400); } throw err; } });
Errors
The base class is OmniSocialsError. API errors are APIError subclasses carrying
status, code, message, and body: ValidationError (400/422),
AuthenticationError (401), PermissionDeniedError (403), NotFoundError (404),
RateLimitError (429, with .retryAfter), ServerError (5xx), plus
APIConnectionError and WebhookVerificationError.