Share to social from your own app

An editor showing an app posting with the SDK: a client from an API key, and a post published when a customer hits a milestone

Some of the best posts come out of the product itself: a customer hits a milestone, a release goes out, somebody tops the leaderboard. @orbitwrite/sdk lets your app write those posts itself, and they land on your calendar with the same slots and approval rules as everything else.

npm install @orbitwrite/sdk

It runs anywhere fetch does, so Node 20 and up, Bun, Deno and edge workers are all fine. There are no runtime dependencies. Keep the calls on your server. The API sends no CORS headers, and a workspace key has no business in browser code.

Posting from your app

Grab a workspace API key under Settings, API keys, and the key does the rest.

import { Orbitwrite } from "@orbitwrite/sdk";

const orbit = new Orbitwrite({ apiKey: process.env.ORBITWRITE_API_KEY });

await orbit.posts.create({
  channels: ["acc_1"],
  content: `${user.name} just published their 100th post.`,
  publishNow: true,
});

Give it a scheduledAt in place of publishNow and the post waits its turn. Ask for the next free slot and five achievements in one hour spread themselves across the week.

const slot = await orbit.schedule.nextTime("acc_1");

Pulling the calendar into your own tools

The calendar reads as easily as it writes, so the queue does not have to live only in Orbitwrite. One call gives you what is going out and when, ready for an internal dashboard, a Notion database, or the Monday standup message nobody wants to write by hand.

const { entries } = await orbit.posts.list({
  status: ["scheduled"],
  limit: 50,
});

Changes can go the other way too. posts.reschedule(groupId, when) moves a post from whatever tool your team is already in, and slots.replace() sets the weekly times, so a quiet week in the product calendar can thin out the posting schedule to match.

What else it does

  • channels.list() gives every connected channel, and channels.postable() narrows it to the ones that can publish right now.
  • posts.iterate() pages through a workspace that has outgrown one response, and posts.get() opens a single post in full.
  • A post you already have also takes publish, unschedule and delete.
  • Each channel can carry its own words: pass { accountId, content } in channels and that network says something different.

The types come from @orbitwrite/openapi, so a field that changes shows up in your editor.

The SDK page has the longer tour, and if a terminal is all you need, the same operations are one command away in the CLI.