News

How I Built an Automated AI-Powered Content Distribution System

How I Built an Automated AI-Powered Content Distribution System

This post walks through the entire build of an automated content distribution app that generates blog posts with AI and publishes them to WordPress, LinkedIn, Facebook, and Instagram on a schedule. It runs on free tiers.

What the project does

The app is called Auto-Poster. It is a Cloudflare Worker that does the following automatically:

  • Generates 1000+ word SEO blog posts with featured images.
  • Publishes the full blog post to WordPress twice per week.
  • Publishes adapted social posts to LinkedIn, Facebook, and Instagram twice per day.
  • Picks unique topics from RSS feeds and a static list, storing used topics in Cloudflare KV to avoid duplicates.
  • Sends email notifications for every successful or failed run via Resend.
  • Uses Unsplash, Pollinations, and Cloudflare Workers AI for featured images.
  • Falls back through multiple free text APIs: Groq allam-2-7b, Groq qwen, and free.ai.

Tech stack

  • Cloudflare Workers for the runtime and cron scheduling.
  • Cloudflare KV for topic deduplication.
  • Groq and free.ai OpenAI-compatible APIs for text generation.
  • Cloudflare Workers AI for image fallback.
  • WordPress REST API for the blog.
  • LinkedIn, Facebook, and Instagram APIs for social posts.
  • Resend for email notifications.

Step 1: Create the Cloudflare Worker project

I created a new directory and used Wrangler to scaffold a Cloudflare Worker project. The main file is src/index.js, and the config is in wrangler.toml.

npx create-cloudflare command-center
cd command-center
npm install

The Worker exposes two handlers: fetch for manual posts and helper endpoints, and scheduled for cron-triggered posts.

Step 2: Generate text with fallback AI models

I use the Groq API through an OpenAI-compatible endpoint. The prompt asks the model to return the post in a strict format with title, slug, focus keyword, meta description, excerpt, tags, and a long HTML body.

If the primary Groq model allam-2-7b fails, the Worker tries qwen/qwen3.6-27b. If that also fails, it calls free.ai with models like qwen7b and mistral before giving up.

Step 3: Generate and upload the featured image

The image generation works in three layers:

  1. Unsplash for real stock photos.
  2. Pollinations for AI images.
  3. Cloudflare Workers AI as a final fallback.

Step 4: Publish to WordPress

The Worker creates a WordPress post through the REST API and sets the following fields:

  • Title, slug, content, status, and excerpt.
  • Featured media.
  • Yoast and RankMath SEO meta.

Step 5: Post to social platforms

  • LinkedIn with native image upload.
  • Facebook with a social-style caption using the excerpt.
  • Instagram with a 10-second wait for media readiness.

Step 6: Email notifications with Resend

The Worker emails a summary after every run. The FROM_EMAIL domain must be verified in Resend.

Limitations and pain points

  • Built only with free services.
  • Built end-to-end with the free Devin SWE-1.7 coding model.
  • The AI has a training cutoff, so current events come from RSS titles, not live research.
  • Free models can be short or produce strange formatting.
  • Facebook and Instagram tokens expire quickly without the custom refresh endpoint.
  • Resend requires domain verification.

The repo is public at github.com/chadfuse/command-center, and the README includes full setup instructions.

Chad Sia

Written by Chad Sia

Senior Front-End Architect & Custom WordPress Engineer (17+ Years)

Chad Sia specializes in building sub-second web platforms, bespoke WordPress architectures, and high-converting acquisition funnels for global founders and brands.

Further Reading

More Engineering Insights

Need Custom WordPress Architecture?

Let’s Build a Sub-Second Web Experience

Ready to optimize your Core Web Vitals, build a bespoke custom theme, or scale your platform? Connect directly with Senior Architect Chad Sia.

Start Project Discovery View Live Portfolio