Quickstart
Connect an account, check a post, and publish it in five minutes.
You need a SociaMesh project and an API key from the console.
Keys look like sm_live_… (real posts) or sm_test_… (dry runs: everything is validated and
prepared, nothing reaches a platform). Start with a test key.
1. Install the SDK
npm install @sociamesh/sdkThe packages are published at general availability. Until then, build packages/sdk-typescript
(or packages/sdk-python) from the repository and install the packed tarball.
Or Python: pip install sociamesh. Or call the REST API directly; every example below has a curl form in the reference.
2. Connect an account
import { createSociaMesh } from "@sociamesh/sdk";
const sm = createSociaMesh({ apiKey: process.env.SOCIAMESH_API_KEY! });
const { url } = await sm.connect.start({ path: { platform: "bluesky" } });
// Send your user's browser to `url`. They approve on Bluesky and come back connected.Then list the connected accounts and keep the id:
const { data } = await sm.accounts.list();
const accountId = data[0].id; // acct_…3. Check the post
const check = await sm.posts.validate({
body: {
content: "Hello from SociaMesh",
publishNow: true,
platforms: [{ platform: "bluesky", accountId }],
},
});
if (!check.valid) console.log(check.issues);Validation is free and writes nothing. It reports every problem for every account at once: text too long, media the platform won't take, a required option missing.
4. Publish
const post = await sm.posts.create({
body: {
content: "Hello from SociaMesh",
publishNow: true,
platforms: [{ platform: "bluesky", accountId }],
},
});The API waits a few seconds for the platforms. If they answer in time you get 200 with each
account's result; otherwise 202 { status: "publishing", postId } and the work continues. Poll
GET /v1/posts/{id} or, better, subscribe to webhooks.
A result is published only when the platform confirmed it, with platformPostUrl set.