Skip to content

the-meta-value/auto-blogger

Repository files navigation

Auto-Blogger

This kit auto-publishes to your WordPress using the REST API. It can publish from local drafts or generate with OpenAI.

1) Prereqs

  • Python 3.10+
  • A WordPress site (I went with a custom domain from Namecheap and installed a Wp plugin through there)
  • A WordPress Application Password (Users → Profile → Application Passwords). Copy the 24-character password and remove spaces.
  • If you want to make it AI generated then get an API key and model to generate posts. I went with gpt-oss-120b

2) Install

python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp config.example.toml config.toml

Edit config.toml with your credentials. If you skip the API, the script will only post from the drafts/ queue.

3) Test WordPress REST & Auth

Quick check (should return posts JSON):

python - <<'PY'
import base64, requests
u="YOUR_WP_USERNAME"; p="YOUR_APP_PASSWORD_NO_SPACES"
b64 = base64.b64encode(f"{u}:{p}".encode()).decode()
r = requests.get("https://YOUR_DOMAIN_NAME/wp-json/wp/v2/posts", headers={"Authorization": "Basic "+b64})
print(r.status_code, r.text[:200])
PY

If status is 200, you're set. If 401, re-check username/password and that Application Passwords are enabled.

4) Run once

python autopost.py

It will publish one post (default) from drafts/ (or AI if configured). Logs go to run.log.

5) Automate (cron)

On Linux:

crontab -e
# Publish every day at 9:07 AM server time
7 9 * * * /usr/bin/env bash -lc 'cd /mnt/data/ai_autoposter_ai_online && source .venv/bin/activate && python autopost.py >> cron.log 2>&1'

Change frequency as you like. Increase posts_per_run in config.toml to publish more per run.

6) Structure

ai_autoposter_ai_online/
  autopost.py
  wp.py
  render.py
  generator.py
  topics.yaml
  drafts/
  config.example.toml  → copy to config.toml and fill
  requirements.txt
  README.md

Drafts are removed when posted (queue behavior).

7) Affiliates

[affiliates] in config.toml is a simple keyword→URL map. The first occurrence of each keyword in the rendered HTML becomes a nofollow sponsored link. A more comprehensive affiliate set up a can be added later with the affiliate tracker.

8) Categories/Tags

First run auto-creates categories and tags listed in config.toml if they don't exist.

9) Tips

  • Start with default_status = "draft" to inspect posts, then switch to "publish".
  • Keep a 20–50 post queue in drafts/ for a natural cadence if you don't want to use AI generation.
  • For social sharing, consider Jetpack Social or Buffer to auto-share new posts.
  • For SEO, install RankMath or Yoast in WordPress.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages