DEV Community

Rohan sirohi
Rohan sirohi

Posted on

How I Built a Multi-Platform Social Publisher in 50 Lines of Python

Every developer building something with social media eventually hits the same wall. You ship Instagram first, it takes a week. Then the client asks for TikTok. Another week. Then YouTube. Then Facebook. By the time you've wired up five platforms, you've got five separate auth flows, five different video format requirements, five rate limit strategies, and five things that will break independently on a Friday night.

This is the integration tax. And it's brutal.

Here's how I stopped paying it.

The Problem in Numbers

Let me be specific about what "maintaining 10 social media integrations" actually costs:

  • Instagram Graph API: OAuth 2.0, chunked resumable uploads, a separate container creation step, then a publish step. Reels require a specific aspect ratio or they silently crop.
  • TikTok Content Posting API: Different OAuth flow, .mp4 only, max 4GB, title required (not optional), and video duration limits that differ by account type.
  • YouTube Data API v3: OAuth with refresh tokens, multipart upload, processing delay before the video is available.
  • X (Twitter) v2: 512MB limit for video, requires a chunked upload via a media endpoint separate from the tweet endpoint.

And that's before you add scheduling, retries, format conversion, or per-platform captions.

The real cost isn't the first integration. It's every API change, every quota increase request, every token refresh bug at 3am.

The Alternative

I built InReelForge to solve this for myself first. One REST endpoint that handles all of it. Here's what a complete cross-platform publish looks like in Python:

import indreelforge
import os

client = indreelforge.Client(api_key=os.environ["INDREELFORGE_API_KEY"])

result = client.publish(
    video="./product-demo.mp4",
    platforms=["instagram", "tiktok", "youtube", "facebook", "x", "linkedin"],
    caption="Shipping something new today. Here's a quick look.",
    hashtags=["buildinpublic", "saas", "developer"],
    schedule="2026-05-01T09:00:00Z",  # optional — omit to publish immediately
)

print(result)
Enter fullscreen mode Exit fullscreen mode

That's 15 lines including imports and the print. The SDK handles:

  • Format validation and FFmpeg transcoding per platform
  • OAuth token refresh for each connected account
  • Retry logic on rate limits
  • Returning per-platform status (published, scheduled, failed, pending)

Per-Platform Customization

Most content isn't identical across platforms. LinkedIn audiences expect more context. TikTok wants a hook in the first two seconds. You can override per platform without losing the defaults:

result = client.publish(
    video="./demo.mp4",
    caption="Default caption for all platforms",
    hashtags=["saas"],
    platforms=["instagram", "linkedin", "tiktok"],
    overrides={
        "linkedin": {
            "caption": "We just launched a new feature for our enterprise clients. Here's a walkthrough of the new team workspace controls.",
            "hashtags=["b2bsaas", "productlaunch", "enterprisetech"],
        },
        "tiktok": {
            "caption": "POV: shipping to prod on a Friday 🚀",
            "hashtags": ["devlife", "coding", "saas"],
        },
    },
)
Enter fullscreen mode Exit fullscreen mode

Handling the Async Reality

Social media platforms don't give you an instant success response. They accept the video, process it, then publish. InReelForge surfaces this with a webhook on Advanced+ plans:

# Your webhook endpoint (Flask example)
from flask import Flask, request
import hmac, hashlib

app = Flask(__name__)

@app.post("/webhooks/indreelforge")
def handle():
    sig = request.headers.get("X-IRF-Signature")
    body = request.get_data()
    expected = hmac.new(
        os.environ["WEBHOOK_SECRET"].encode(),
        body,
        hashlib.sha256,
    ).hexdigest()

    if not hmac.compare_digest(sig, f"sha256={expected}"):
        return "Forbidden", 403

    event = request.json
    print(f"{event['platform']}{event['status']}")  # published | failed
    return "ok"
Enter fullscreen mode Exit fullscreen mode

What This Replaced

Before this, my content pipeline looked like:

  1. instagram_publisher.py — 340 lines
  2. tiktok_publisher.py — 280 lines
  3. youtube_uploader.py — 210 lines
  4. facebook_publisher.py — 195 lines
  5. A cron job per platform, each with its own failure mode

Now it's one file, 50 lines, one API key. The platforms still have all their quirks — the SDK just hides them from my application code.

Getting Started

Sign up free at indreelforge.com — 10 uploads/month on the free tier, no credit card required. The Python SDK is on PyPI:

pip install indreelforge
Enter fullscreen mode Exit fullscreen mode

Full docs at docs.indreelforge.com.

If you've dealt with the integration tax yourself, I'd be curious what your worst platform experience was. Mine was TikTok's undocumented video codec requirements. Drop it in the comments.

Top comments (0)