Menu ☰

Efficient API Usage

Make every request count: batching, pagination, caching, webhooks over polling, and polite backoff — adapted from Buffer's own guidance.

The golden rule
Buffer's guide boils down to this: your integration should do more with fewer requests. buffer_sass gives you one extra lever Buffer never had — webhooks — so most polling can disappear entirely.

1. Batch in one create call

A single POST /2/updates fans out to every target channel and returns one update per channel. Don't loop per-network:

// ✗ one request per network
for (const id of channelIds) await create(id, text);

// ✓ one request, one group
await create(channelIds, text);  // returns updates sharing group_id

2. Fetch exactly what you need

REST lists accept count (max 50) and offset; pages your UI actually renders. In GraphQL, select only the fields you'll display — the response (and the work) shrinks with it.

3. Stop polling — subscribe

Buffer's guide is honest that its API has no webhooks, so sync means polling. buffer_sass ships webhooks: update.sent replaces your queue-poller; channel.connected replaces channel resyncs. Keep at most one low-frequency poll (queue drift safety) instead of several.

// before: every 30s, forever
setInterval(() => GET("/2/channels/:id/updates/scheduled"), 30_000);

// after: zero requests — the event finds you
app.post("/hooks/buffersass", (req) => {
  if (req.headers["x-buffersass-event"] === "update.sent") syncPost(req.body.data);
});
one webhook replaces this poller

4. Cache the slow stuff

Channels, schedules and avatars change rarely. Cache them for minutes, not seconds, and invalidate on channel.connected / channel.schedule_updated webhooks. Metering only counts requests — caching is free money.

5. Back off on 429 — don't hammer

Read X-RateLimit-Remaining; on 429, honor Retry-After with exponential backoff + jitter. A well-behaved client virtually never sees the limit at 600 req/min.

6. Use the sandbox for load tests

The sandbox is unmetered and structurally identical. Prototype your retry logic, burst behavior and pagination edge cases against bsk_test_ before touching live quota.

Checklist

  • One create call per campaign, not per network
  • Paginate with count/offset; select narrow GraphQL fields
  • Webhook for update.sent; poll as backup only
  • Cache channels & schedules; invalidate via webhooks
  • Exponential backoff with jitter on 429
  • Monitor GET /2/usage or the Usage page