2 min read

I built an X automation agent (and learned some hard lessons)

I built an X automation agent (and learned some hard lessons)

I just shipped something I've been working on: an agent that publishes X articles in under 2 minutes.

If you've been following along, you know I built a voice-to-newsletter agent a week ago. That solved the "I don't have time to write" problem. But I was still spending an hour per article on X: formatting, uploading images, clicking through menus.

So I decided to automate it.

What I learned the hard way

The "obvious" approaches all failed:

  • Puppeteer and Playwright — Cloudflare blocked them immediately. X's bot detection is aggressive.
  • JavaScript clicks — React ignores them. The button was there, my code found it, but nothing happened.
  • System clipboard — X's editor (Draft.js) rejected it. It validates where clipboard data comes from.

Each failure taught me something about how platforms actually work under the hood. The breakthrough wasn't better code: it was deeper understanding.

The insight

You can't automate at the surface level. You have to understand how the platform works internally:

  • Cloudflare fingerprints headless browsers → use a real browser with debugging enabled
  • React only responds to real mouse events → send CDP mouse events, not JavaScript clicks
  • Draft.js validates clipboard origin → inject HTML from inside the browser context

Once you understand the rules, your agent can work around them.

The result

One command, under 2 minutes. Title, content, cover image: all automated. My office lights even turn yellow while it runs so I know not to interrupt (for real, you can see it in the video at 2:59 😂).

Watch the full demo

I recorded a 5-minute video showing the entire workflow from start to finish:

The bigger picture

This is part of something bigger I'm building: my own ContentOS.

Voice memo → newsletter → X article → LinkedIn. The automation handles distribution so I can focus on creating.

X article automation workflow: Markdown → x-article CLI → X draft
The X article publishing workflow

The X article agent was the hardest piece to crack. Now that it works, publishing is as easy as thinking.

More updates coming soon.

Kevin