OmniSocialsOmniSocials
DocumentationAPI reference
Help centerSupport
  • Documentation
  • API reference
Developers
  • Quickstart
  • API reference
  • SDKs
  • MCP server
  • CLI
For AI agents
  • Docs for AI agents
  • llms.txt
  • OpenAPI spec
  • Postman collection
Product
  • OmniSocials
  • Pricing
  • Changelog
  • Help center
Company
  • Support
  • Privacy policy
  • Terms of service

© 2026 OmniSocials

OmniSocials on GitHubOmniSocials on XOmniSocials on LinkedIn
Overview
Get started
SDKs
    Node.jsPythonGoRubyJavaPHP.NETRust
CLI
MCPDocs for AI agentsWebhooks
Guides
Platforms
Integrations
Connect
Migrate
Plans and billing
GlossaryChangelogAPI reference
SDKs

Node.js SDK reference: install, auth and methods

The official Node.js / TypeScript SDK. Zero runtime dependencies (native fetch), Node 18+, ships ESM and CommonJS, fully typed.

This page is the reference. For an overview of the Node.js SDK, see omnisocials.com/sdk/nodejs.

Install

TerminalTerminal
npm install @omnisocials/sdk

Authentication

TypeScript
import { OmniSocials } from "@omnisocials/sdk"; const client = new OmniSocials({ apiKey: "omsk_live_..." }); // or set OMNISOCIALS_API_KEY and call new OmniSocials()

CommonJS: const { OmniSocials, verifyWebhookSignature } = require("@omnisocials/sdk");

Create a post

TypeScript
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), Pinterest, Instagram (images), and LinkedIn (images):

TypeScript
media_urls: [{ url: "https://example.com/teaser.jpg", alt: "Red sneaker on a white background" }],

Publish immediately:

TypeScript
await client.posts.createAndPublish({ content: "Going live right now", channels: ["x", "bluesky"], });

Upload media

TypeScript
const upload = await client.media.uploadFromUrl({ url: "https://example.com/launch-video.mp4", name: "launch-video-v2", folder: "Campaigns", }); console.log(upload.data.id, upload.compatibility);

Local files via multipart:

TypeScript
// From a path const res = await client.media.upload({ file: "./photos/product.jpg", name: "product-hero" }); // Or from bytes / a Blob import { readFile } from "node:fs/promises"; const bytes = await readFile("./photos/product.jpg"); await client.media.upload({ file: bytes, filename: "product.jpg" });

Analytics

TypeScript
// One post's latest per-platform metrics const { data: stats } = await client.analytics.post("post_id"); console.log(stats.platforms.instagram?.metrics); // Batch: up to 100 posts in one call const batch = await client.analytics.posts(["id1", "id2", "id3"]); // Workspace-wide overview const { data: overview } = await client.analytics.overview({ period: "30d" }); console.log(overview.total_impressions, overview.total_engagements); // Account-level stats (followers etc) const accounts = await client.analytics.accounts({ platform: "instagram" });

X statistics

X bills every statistics read, so these calls can use credits. See X statistics and credits for the prices and the rules. accounts:write and credits:read are opt-in: the Credits and X statistics switch when you create the key, and billing rights for the key's creator.

TypeScript
// How often an X account is read: posts full / light / off, followers daily / weekly / off await client.accounts.update("1234_x", { x_statistics: { posts: "light" } }); // "Update now": read one post's X numbers now const { data: fresh } = await client.analytics.refreshPost(9123); console.log(fresh.credits_used, fresh.tweets.length); // The balance and the X statistics use const { data: credits } = await client.credits.get(); console.log(credits.balance, credits.x_statistics.total_credits_month);

Post tags

Tags are your own labels for posts (a hook style, a format), to filter posts and compare how each kind does. They never go to a platform. A tag is { id, name, color, created_at } (type Tag).

TypeScript
await client.tags.create({ name: "Question", color: "teal" }); await client.tags.list(); // On a post: ids or names, a new name becomes a tag. On update, null or [] removes all. await client.posts.create({ content: "Would you post this?", channels: ["instagram"], tags: ["Question"] }); // Up to 500 posts at once: add, remove or set (replace) await client.tags.apply({ post_ids: ["1024", "1025"], add: ["Question"] }); // Filter, and compare each tag with your normal await client.posts.list({ tag: "Question" }); const { data: compare } = await client.analytics.tags({ start_date: "2026-08-01" }); for (const row of compare.tags) { console.log(row.tag.name, row.vs_normal); // 0.38 = 38% above your normal }

client.tags.update(id, { name, color }) and client.tags.delete(id) manage a tag; analytics.overview({ tag }) narrows the post numbers to tagged posts.

Limits and feature requests

client.limits.list() (GET /limits) lists what OmniSocials cannot do, why, and what to do instead. client.featureRequests.create() sends a request to the OmniSocials team for the person who owns the key, so send it only after the person agrees; a platform rule answers 409 not_requestable and stores nothing. More in Limits and feature requests.

TypeScript
const { data: limits } = await client.limits.list({ platform: "tiktok" }); for (const limit of limits) { console.log(limit.title, limit.says, limit.instead, limit.requestable); } // Only after the person agrees const { outcome, data: request } = await client.featureRequests.create({ summary: "Post our daily update to the Announcements topic of our Telegram group.", platform: "telegram", limit_id: "telegram.forum_topics", }); console.log(outcome, request.id); // "created", "voted" (a vote on your organisation's open request) or "already_requested" const { data: mine } = await client.featureRequests.list(); // newest first, with status and team_replies

Social Inbox

Read and answer DMs, comments and mentions from your connected accounts. The API key needs the opt-in inbox:read / inbox:write scopes. The lists use cursor pagination (cursor in, pagination.next_cursor out).

TypeScript
const { data: conversations } = await client.inbox.listConversations({ platform: "instagram", unread: true, }); const conversationId = conversations[0].conversation_id; const { data: messages } = await client.inbox.getMessages(conversationId); await client.inbox.reply(conversationId, { text: "Thanks for reaching out!" }); await client.inbox.markRead(conversationId); // Comment moderation: hide (pass { hide: false } to unhide) or delete await client.inbox.hide(messages[0].id); await client.inbox.deleteMessage(messages[0].id);

inbox.next() hands out the next conversation that still needs an answer, with the thread and the post it belongs to. On a comment thread, pass message_id so the reply goes under the comment you answer and not under the newest comment on the post. On a Facebook comment, mention_author: true tags the commenter: the reply starts with their name as a clickable link, and the answer carries mention with the result (tagged, plain_name, failed or unverified).

TypeScript
let { data: item, remaining } = await client.inbox.next(); while (item) { if (!item.reply_window.open) { // An Instagram/Facebook DM past Meta's 24-hour window: answer it in the app await client.inbox.markRead(item.message.conversation_id); ({ data: item, remaining } = await client.inbox.next()); continue; } const reply = await client.inbox.reply(item.message.conversation_id, { text: "Thanks! DM sent.", message_id: item.message.id, include_next: true, }); item = reply.next ?? null; remaining = reply.remaining ?? 0; }

See the Social Inbox guide for the platforms, the reply rules and the error codes.

Pinterest product tags

Tag products on a Pin so people can shop the items in the image. List the product Pins of the connected Pinterest account, then pass up to 24 of their Pin ids as product_tags in the pinterest options of the post. Only product Pins of your own account can be tagged; products of other merchants cannot.

TypeScript
const list = await client.pinterest.listProducts(); if (list.error) { console.warn(list.error.code, list.error.message); } else { await client.posts.create({ content: "Our summer picks", channels: ["pinterest"], media_urls: ["https://example.com/summer-look.jpg"], scheduled_at: "2026-08-01T09:00:00Z", pinterest: { board_id: "1234567890", product_tags: (list.products ?? []).slice(0, 3).map((product) => product.pin_id), }, }); }

The list answers with HTTP 200 in both cases: products on success, or an error object (pinterest_not_connected, pinterest_catalog_access_required, platform_error) when it could not be read. It reads the Pinterest catalog when the connection has catalog access (given one time in the OmniSocials composer: Pinterest options, Add products, Connect catalog), else the account's own Pins. The tags are added right after the Pin is published. A product that Pinterest refuses never fails the post: the post then carries pinterest.product_tags_result with the tagged and the skipped Pin ids. client.pinterest.validateProduct(id) checks one Pin id or Pin link before you post. On posts.update() the pinterest object replaces the stored one, so leave product_tags out to remove the tags.

Approve or reject a post

Pass the step you reviewed: the current_step of the post's approval review. When the review is on another step now (somebody decided since you read it, or a retried call already went through), nothing is decided and the call fails with 409 step_changed; error.current_step_order in the error body is the step the review is on now. Without a step the call acts on whatever step is current. client.posts.approve(id) and client.posts.reject(id, "comment") still work.

TypeScript
const { data: review } = await client.posts.getApproval(id); try { await client.posts.approve(id, { step_order: review.current_step ?? undefined }); // or: await client.posts.reject(id, { comment: "Wrong CTA link", step_order: review.current_step ?? undefined }); } catch (err) { if (!(err instanceof APIError) || err.code !== "step_changed") throw err; // The review moved on; nothing was decided. Read the approval again. }

Verify webhooks

TypeScript
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; case "post.rejected": console.warn("Rejected:", event.data.post_id, event.data.approval?.reason); break; } res.sendStatus(200); } catch (err) { if (err instanceof WebhookVerificationError) { return res.sendStatus(400); } throw err; } } );

Events: post.scheduled, post.published, post.failed, post.approved and post.rejected. The two approval events carry data.approval with status, decided_by (the approver's user id) and reason (null on post.approved). To read the full review of a post (steps, approvers, the rejection reason and the comment thread), call client.posts.getApproval(id).

Rotate the secret without missing deliveries

For 24 hours after client.webhooks.rotateSecret(id), every delivery also carries X-OmniSocials-Signature-Previous, signed with the old secret (same format, same timestamp and body). Verify X-OmniSocials-Signature with the new secret and, when that fails, the Previous header with the old one:

TypeScript
let event; try { event = verifyWebhookSignature({ payload: req.body, signature: req.get("X-OmniSocials-Signature") ?? "", secret: NEW_SECRET }); } catch (err) { const previous = req.get("X-OmniSocials-Signature-Previous"); if (!(err instanceof WebhookVerificationError) || !previous) throw err; event = verifyWebhookSignature({ payload: req.body, signature: previous, secret: OLD_SECRET }); }

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.

TypeScript
import { APIError, RateLimitError, ValidationError, APIConnectionError } from "@omnisocials/sdk"; try { await client.posts.create({ content: "Hi", channels: ["instagram"] }); } catch (err) { if (err instanceof RateLimitError) { console.warn(`Rate limited, retry in ${err.retryAfter}s`); } else if (err instanceof ValidationError) { console.error(`Bad request (${err.code}): ${err.message}`, err.body); } else if (err instanceof APIConnectionError) { console.error("Network problem:", err.message); } else if (err instanceof APIError) { console.error(`API error ${err.status} (${err.code}): ${err.message}`); } else { throw err; } }

Configuration

TypeScript
const client = new OmniSocials({ apiKey: "omsk_live_...", baseUrl: "https://api.omnisocials.com/v1", // default timeout: 30_000, // per-request timeout in ms (default 30s) maxRetries: 2, // automatic retries on 429 / 5xx / network errors (default 2) });

Note that timeout is in milliseconds; the other SDKs use seconds or durations.

Notes

  • Responses destructure as { data }; list endpoints return { data, pagination }
  • 204 deletes resolve to null
  • client.health() returns { status, version, timestamp }
  • Source: github.com/OmniSocials/omnisocials-node
Last modified on November 24, 2026
SDKsPython
On this page
  • Install
  • Authentication
  • Create a post
  • Upload media
  • Analytics
    • X statistics
  • Post tags
  • Limits and feature requests
  • Social Inbox
  • Pinterest product tags
  • Approve or reject a post
  • Verify webhooks
    • Rotate the secret without missing deliveries
  • Errors
  • Configuration
  • Notes
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript