Claude Templates / A-tier · High leverage
Outreach
The Publishing Pipeline Playbook
Scheduled posts, a scheduler tick, provider guards, and per-platform normalization.
PUBLISHING-PIPELINE-PLAYBOOK.md · 17 sections · 3,170 words · 25 KB · markdown
By Moe Ameen, founder of BILT · Published · Updated
The Publishing Pipeline Playbook is for apps that post content to outside platforms on a schedule. Claude Code builds a scheduled_posts table with a state machine, a scheduler-tick cron, a publish worker, advisory locks so two instances can't post the same row, per-platform text limits and media checks, a reconciler for posts whose callback never arrived, and an HMAC-signed webhook publisher with SSRF guards.
Key takeaways
- Posts move through a state machine in scheduled_posts.
- Advisory locks stop two workers sending the same post.
- Platform text limits come from each platform's own docs, never guesses.
- Media is copied to your storage; provider URLs are never stored.
For any app that pushes content to external APIs on a schedule. A scheduled_posts queue, a tick worker that can't double-send, per-platform payload normalization, character and media gates, and failure handling that surfaces in the UI instead of dying silently.
What does the Publishing Pipeline Playbook build?
It builds the queue, workers and guards behind scheduled social or blog posting, whether the provider is direct OAuth, an aggregator, GoHighLevel or a custom webhook.
It also covers status roll-up so a multi-platform post shows one honest status.
When do you need a publishing pipeline?
You need it as soon as an app publishes to third-party APIs on a user's behalf. Double posts and silent failures are the bugs it is written around.
For a one-off script that posts once a day, it is more structure than you need.
What do you need first?
You need App Infrastructure and Trigger.dev Workers, a list of target platforms and which publisher owns each, and each platform's text limits and media rules.
An HMAC secret is optional, for signing outbound webhooks.
What's inside
What does the playbook give you?
- //The scheduled_posts schema with a claim-and-lock dispatch
- //A scheduler-tick worker safe against overlapping runs
- //Provider call guards + per-platform payload normalization
- //Character limits and media-format gates enforced before send
- //Media persistence: never store an expiring provider URL
- //A reconciler for posts whose provider callback never arrived
When to use it
Any app that publishes to third-party APIs.
Build these first
Straight from the file
What does the writing look like?
The browser may dispatch but never await. Manual "Post Now" inserts a scheduled_posts row with publish_at = now() and lets the same worker pick it up — the manual path and scheduled path share one publish surface so they cannot drift apart.
Table of contents
Which sections does the file cover?
- 0. Use this spec
- 1. Architecture
- 2. The Universal-Worker rule
- 3. Schema
- 4. Cross-instance advisory lock (provider-call-guard)
- 5. Platform-name normalization (wire-platform.ts)
- 6. Per-platform text truncation (platform-limits.ts)
- 7. Reconciler with terminal-history gate
- 8. Stage-failure vs post-call ambiguity (the retry-revert)
- 9. Pre-flight media check
- 10. Media URL handling — never store provider URLs
- 11. Per-gc staging cache (dedupe.ts)
- 12. Generic webhook publisher (HMAC + SSRF)
- 13. Status aggregation (sync-generated-content-status)
- 14. Common pitfalls
- 15. Test plan (smoke)
- 16. Kickoff prompt
How do you run it?
Drop PUBLISHING-PIPELINE-PLAYBOOK.md into your repo, then tell Claude Code: “Read PUBLISHING-PIPELINE-PLAYBOOK.md and implement it in this codebase.” It's written for an agent to execute end to end. Search the file for angle-bracket placeholders and swap in your own project names, domains, and keys before the first run.
Who is this for, and who should skip it?
Best for
- Social scheduling and content apps
- Apps publishing to several platforms through different providers
- Teams that have been burned by duplicate posts
Not ideal for
- Apps that only send email (see Email Infrastructure)
- Single-platform scripts with no user scheduling
- Products without a worker runtime
- Builders who won't adapt paths: the file points to a reference app you won't have
What else do people ask?
Does the Publishing Pipeline Playbook require Trigger.dev?
No. The Publishing Pipeline Playbook uses Trigger.dev v4 in its reference app but says an equivalent queue such as Inngest, BullMQ or AWS SQS works too, and the kickoff prompt asks which one you use.
Which platforms and providers does it cover?
The Publishing Pipeline Playbook's scheduled_posts schema allows 15 platforms: instagram, facebook, tiktok, youtube, linkedin, pinterest, threads, bluesky, twitter, rumble, mailchimp, medium, ghl_blog, wordpress and webhook. Each one can be owned by a different publisher: direct OAuth, Blotato, GHL, Bundle.social or a custom webhook.
Should I use the character limits listed in the file?
The Publishing Pipeline Playbook lists limits in PLATFORM_TEXT_LIMITS (Twitter 280, Bluesky 300, Threads 500, among others), but says real limits must come from each platform's public docs and never be guessed. Its truncateForPlatform helper leaves text alone for unknown platforms so the API returns its own error.
What is in the Publishing Pipeline Playbook download?
The Publishing Pipeline Playbook is a markdown file of about 3,200 words. It has SQL for scheduled_posts, its partial unique index and publish_locks, TypeScript for the provider-call guard, the stage-failure revert and media preflight, the HMAC signing and SSRF rules for webhooks, a nine-step smoke test and a kickoff prompt.
How does it decide whether a failed publish is safe to retry?
The Publishing Pipeline Playbook reads a stage field on the failure response, not the row state. A failure before the provider was called (stage 'media-staging') reverts the row from submitted to queued for a retry, and anything else goes to failed because the provider may already have the post.
How do we know this?
This page is based on the playbook file itself, PUBLISHING-PIPELINE-PLAYBOOK.md, which Moe Ameen wrote from the Kompozy codebase (called BKE in the file). We read the file on November 4, 2026; the facts here come from it, not from independent testing in other codebases.
More outreach playbooks
SMS Copilot Console
Cold-SMS auto-reply: an LLM brain that drafts, and code that decides.
Read + download →A-tierCold Email Campaign
The operational side: folder structure, daily metrics, A/B/C subjects, leak diagnosis.
Read + download →B-tierGoHighLevel Integration
OAuth, tokens, publishing and webhooks: the GHL API gotchas up front.
Read + download →