Cross-posting Instagram and TikTok content to Facebook sounds like a 200-line script. We recently built one for a multi-location F&B brand, and the production version has none of the parts you'd expect at the top — and three things that were completely unexpected.
Sharing the patterns here in case anyone is working on similar cross-platform sync problems. No client names, no proprietary code — just the engineering decisions and why they matter.
The brief
The client has Instagram, TikTok, and Facebook accounts. Their team was manually copy-pasting between platforms every week — fighting expired CDN URLs, fixing captions whose timing no longer made sense, and re-uploading media because direct source URLs aren't fetchable from elsewhere.
The ask was straightforward: "copy new posts from IG and TikTok to FB, on a schedule."
Why "API → API" doesn't work
Three gotchas that aren't visible until you start building:
1. CDN URLs aren't third-party-fetchable
Instagram's scontent.cdninstagram.com and TikTok's tiktokcdn.com URLs are signed and IP-bound, with short expiry windows. Pass them to a publishing service like Buffer and it will fail to fetch the media — the URL only works from the original viewer's session.
Fix: download the media in our worker, re-upload to a public storage we control (Cloudflare R2 — 10GB free, well-priced beyond), then submit the rehosted URL.
The extra round-trip adds about a second per asset. Worth it for stability.
2. Captions go stale
A post that says "GRAND OPENING this Friday 2/13!" makes sense on Feb 4. Three months later, when a cron picks it up to cross-post, that line is misleading, not just outdated.
We added an AI caption moderator that reads the caption together with the original post date and today's date, and decides:
- Time-sensitive references that no longer match ("this Friday", "grand opening", countdowns) → reframe as a memory/throwback. Convert future tense to past, drop CTAs that don't apply.
- Evergreen content (general menu praise, location info) → pass through verbatim.
- Third-party reviewer voices ("@brand just opened, the food was great") → rewrite in the brand's first person while preserving substance.
We used Claude Haiku via Vercel AI Gateway. About a tenth of a cent per caption. The decision-tree-with-LLM-fallback design means we never pay for the LLM on content that doesn't need it.
This was the highest-leverage feature. A cron that pastes captions verbatim looks sloppy in a way an AI rewriter doesn't.
3. Bot detection
Posting five captions to a brand's Facebook page in two minutes will get flagged. Posting them spread across the day looks human.
The cron uses a "mixed" mode: the first new post fires immediately (oldest content shouldn't wait further), the rest go into the publishing tool's queue and land in the brand's existing posting schedule. The pacing comes free as long as Buffer (or whatever publishing layer you use) has a daily schedule configured.
Dedupe — a 30-line feature with outsized impact
Brands routinely cross-post the same content on IG and TikTok. If a cron treated them as two distinct items, the brand's FB feed would show visible duplicates.
We compute a content fingerprint per post — normalize the caption (lowercase, strip emojis/hashtags/URLs), SHA-256, take 16 hex chars. The fingerprint is stored alongside the source ID. Before publishing, we check three sets:
- Source-ID set — have we synced this exact IG or TikTok post before?
- Fingerprint set — have we already posted the same content from a different source?
- Buffer recent-posts — re-fetch the last 25 posts on the destination channel and add their fingerprints to the seen-set, in case someone posted manually.
A small feature, but it's the difference between "looks automated and lazy" and "looks like someone actually thought about it."
Stack
Mostly off-the-shelf, intentionally:
- Apify for IG/TikTok scraping (the free tier handled a daily cron with room to spare)
- Cloudflare R2 for media rehosting (S3-compatible, generous free tier)
- Vercel AI Gateway for the caption moderator
- Buffer for the actual FB publishing (avoids managing Meta Graph API page-access-token rotation)
- Postgres on Neon for sync history and the dedupe state
-
GitHub Actions for cron scheduling (one workflow, multiple
on.scheduleentries, routed to endpoints bygithub.event.schedule)
No Kubernetes. No queue worker. No custom scraper infrastructure. Total monthly cost on a small client at this volume: zero.
What we actually shipped
- Manual cross-posting time: from hours per week to zero.
- Captions automatically adapt to repost time — no more time-sensitive language pasted out of context.
- Brand voice preserved across sources (third-party content reframed in first person).
- An admin dashboard surfacing sync history, recent posts, and run health — so operators can spot-check what got posted.
The boring takeaway
Most "AI automation" content focuses on the AI. The interesting parts of this build had nothing to do with the AI — they were the CDN rehosting, the fingerprint dedupe, the cadence shaping. The AI does maybe 20% of the work but gets 80% of the attention.
The other 80% of the value is in the unglamorous data plumbing that makes the AI's outputs land cleanly on the right page at the right time. If you're building something similar, that's where to spend your effort.
The team at JY Tech builds automation pipelines like this for F&B, retail, and SaaS clients. Happy to compare notes if you're working on similar cross-platform sync problems.
This article was originally published by DEV Community and written by AutoClaw.
Read original article on DEV Community