AI Social-Content Pipeline
An n8n pipeline that drafts a brand's daily post and auto-publishes it across platforms — a human only approves.
- 2025—
- live
- Architect & Implementer
- Python, n8n, OpenAI, Gemini, Notion API, Meta Graph API
Keeping a brand's feed alive — image, caption, hashtags, posting on every platform — was a daily owner chore. This pipeline produces a complete on-brand post each day and auto-publishes across platforms; a human only approves.
- image, caption, hashtags, posting — all by hand
- auto-drafted; a human only approves
3 platforms
since 2025
The technical breakdown
The business problem
Keeping a brand's social presence alive is a daily grind, and it falls on the owner: find a usable image — and judge whether it's even good enough to post — write the caption, devise a title, hashtags and emojis, then post it by hand on each platform separately. Skip a few days and the account stalls; do it properly and it eats the time the owner doesn't have. The goal was a pipeline that produces a complete, on-brand post every day and publishes it across every platform automatically — with the owner doing nothing but approve.
The architecture
A pipeline orchestrated by n8n on a self-hosted server, with the publishing workflows code-generated from Python so they're versioned and reproducible from source rather than hand-wired in a UI.
A daily run rotates the post type (the same type never runs two days straight) and picks a publish time from a date-seeded jitter, so re-running a day reproduces the identical schedule instead of a random one. A copywriter LLM drafts the caption; a separate critic LLM judges it against explicit brand rules and, on issues, sends exactly one revision back. An image model produces the visual where the post type calls for it (some types use a human photo brief instead). The finished draft lands in a Notion approval queue; a human approves there or via a Telegram bot, and only then does an n8n auto-poster — polling the queue every ten minutes — publish to Instagram (feed + reels), Facebook, and Google Business Profile.
A critic is a different role, not a second opinion from the same prompt — and the generator never holds the keys to publish.
Lesson-memory that compounds. Every critic correction is normalized, hashed to a stable id, deduplicated and counted; the five most-recent corrections are injected into the copywriter's prompt on the next run. The system stops repeating the same mistakes without any retraining — the prompt carries the institutional memory (for example: never open with a particular cliché phrase — flagged four times).
Decisions & trade-offs
The generator never holds the publish button. Everything lands in the approval queue as a draft, and a separate auto-poster publishes only what a human approved. It's the cheapest insurance a brand-facing LLM system can buy — at the cost of one daily human touchpoint that keeps it honest.
Code-generate the workflows from Python. The publishing graphs are built by Python from source, not clicked together in the n8n UI, so they're diffable and reproducible. The trade-off is a build step between you and the running workflow — and the worst bug lived exactly there.
Deterministic scheduling. Post times come from a date-seeded jitter, so re-running a day is idempotent and debuggable while the feed still looks human-timed — nothing double-fires from a re-run.
What broke
Duplicate posts went live — the customer-facing one. The workflow generator reused identical node names for two steps, and because n8n keys its connections by node name, the generated graph accumulated duplicate edges: the same post published twice to Instagram and four times to Facebook and Google Business Profile before anyone caught it. The fix was structural — unique node names, a build-time validation pass with explicit structural checks, a dry-run workflow variant, and a real test suite — turning "looks right in the UI" into "fails the build if the graph is malformed."
Hardening the prompt crashed the model. After tightening the copywriter's system prompt with a ban-list and hard rules, the first run crashed with a length error: handed a long, rule-laden prompt plus a strict JSON-schema constraint, the model spun trying to satisfy every rule and hit its ~16K output ceiling without ever closing the JSON. Capping the output tokens only moved the cliff; the real fix was condensing the prompt itself.
More rules made the output less reliable, not more — past a point, prompt weight is a cost, not a safeguard.
Getting images to the platforms was its own saga: the social APIs couldn't fetch the temporary upload URLs, so every image had to be pre-staged in dedicated public storage before posting.
The outcome
Running daily in production since 2025. The real value is removing the daily production burden — sourcing an image, writing the caption, devising title and hashtags, and posting across every platform — so the account publishes consistently without the owner finding time to make each post by hand. Over the same window the account grew from ~350 to ~1,200 followers — a correlational signal across the period the pipeline ran, not a controlled result, and not the headline claim.