Nimply Developers
Examples

Poll until published

Publish a post now, then poll until it's PUBLISHED or FAILED.

Scopes: posts:write, posts:publish, posts:read.

"Publish now" is asynchronous: the post is queued, so the create response shows it as SCHEDULED, not PUBLISHED. To know it actually went live, watch for the terminal status — PUBLISHED or FAILED.

Webhooks are the better way

Polling works, but subscribing to post.published and post.failed webhooks tells you the moment it happens, with no request budget spent. Use polling for scripts and one-offs; use webhooks for anything long-running.

1. Create with "schedule": "now"

curl -X POST https://api.nimply.io/v1/posts \
  -H "Authorization: Bearer $NIMPLY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: hotfix-announcement-001" \
  -d '{
    "channelIds": ["123e4567-e89b-12d3-a456-426614174000"],
    "content": "We just shipped a fix — safe to update now.",
    "schedule": "now"
  }'
[
  { "id": "7a245d46-…", "status": "SCHEDULED", "publishedAt": null }
]

2. Poll GET /v1/posts/{id}

const API = "https://api.nimply.io/v1";
const headers = { Authorization: `Bearer ${process.env.NIMPLY_API_KEY}` };

async function waitForPublish(postId, { intervalMs = 5000, maxAttempts = 24 } = {}) {
  for (let i = 0; i < maxAttempts; i++) {
    const post = await (await fetch(`${API}/posts/${postId}`, { headers })).json();
    if (post.status === "PUBLISHED") return post;
    if (post.status === "FAILED") throw new Error(`Publishing failed for ${postId}`);
    await new Promise((r) => setTimeout(r, intervalMs));
  }
  throw new Error(`Timed out waiting for ${postId}`);
}

const post = await waitForPublish("7a245d46-…");
console.log("Live at", post.publishedAt);

The same check with curl:

curl https://api.nimply.io/v1/posts/7a245d46-… \
  -H "Authorization: Bearer $NIMPLY_API_KEY"
{ "id": "7a245d46-…", "status": "PUBLISHED", "publishedAt": "2026-07-09T13:55:31.000Z" }

Gotchas

  • Poll politely: a few seconds between requests. Rate limits are per key, and every poll counts against them (watch X-RateLimit-Remaining).
  • With multiple channel ids you get multiple posts — poll each post id; one channel can publish while another fails.
  • The same pattern applies to POST /v1/posts/{id}/publish on an existing draft — its response also returns the post as SCHEDULED.
  • Cap your attempts. Video posts in particular can take a while to process on the platform side.

On this page