Auto-Posting AI Chat Logs from Obsidian to WordPress

Auto-Posting AI Chat Logs from Obsidian to WordPress

I Built a Pipeline to Auto-Post AI Chat Logs from Obsidian to WordPress

Introduction

When you're having a technical conversation with AI, there are moments where you think, "this could be useful later." But in practice, chat history just gets buried — rarely turned into reusable knowledge.

This post covers the design and key implementation details of a pipeline that takes AI consultation logs pasted into Obsidian and automatically converts them into blog posts, then creates drafts in WordPress. I hope it helps anyone facing the same problem.


Pipeline Overview

The flow breaks down into four straightforward steps:

  1. Input — Save chat logs as Markdown in Obsidian's Inbox folder
  2. Trigger — Detect file changes and kick off processing
  3. Process — Use the Claude API to convert the log into a blog article format
  4. Output — Auto-post as a draft via the WordPress REST API
Obsidian (Markdown)
  └─ watchdog (file watcher)
       └─ Claude API (article conversion)
            └─ WP REST API (draft post)

Technology Stack

File Watching: Python watchdog

Python's watchdog library detects change events in a specified directory in real time. It fires an event every time Obsidian saves a file, making it a perfect trigger.

from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler

class MarkdownHandler(FileSystemEventHandler):
    def on_created(self, event):
        if event.src_path.endswith(".md"):
            process_file(event.src_path)

observer = Observer()
observer.schedule(MarkdownHandler(), path="./inbox", recursive=False)
observer.start()

Article Conversion: Claude API

Rather than posting logs as-is, I pass an "article conversion prompt" to the Claude API. The key here is deciding the article format ahead of time.

  • Keep Q&A format → preserves the flow of the conversation
  • Summarize → easier to scan and read
  • Hybrid → intro + Q&A excerpts + conclusion

Example prompt:

prompt = f"""
Based on the AI consultation log below, write a technical blog post.
- Use H2/H3 headings
- Use code blocks where appropriate
- Suggest 3 tags
- Output format: JSON {{ "title": "", "content": "", "tags": [] }}

---LOG---
{raw_log}
"""

WordPress Posting: REST API

The WP REST API lets you post programmatically from outside WordPress. Application Passwords are the current best practice for authentication.

import requests
import base64

def post_to_wordpress(title, content, tags):
    credentials = base64.b64encode(b"username:app_password").decode("utf-8")
    headers = {"Authorization": f"Basic {credentials}"}
    
    payload = {
        "title": title,
        "content": content,
        "status": "draft",  # always post as draft
        "tags": tags,
    }
    
    response = requests.post(
        "https://example.com/wp-json/wp/v2/posts",
        json=payload,
        headers=headers,
    )
    return response.json()

Design Decisions Worth Thinking Through

How much of the raw log feel should you preserve?

AI conversations include the trial-and-error process. If you format everything away, you lose the context of "why we ended up at that conclusion." Keeping some of the Q&A format helps readers follow along with the same thought process.

Auto-assigning tags and categories

Including tag suggestions in the Claude API response can eliminate manual work entirely. That said, until the accuracy is consistent, it's safer to keep the post status as draft and have a human review before publishing.

Preventing double-processing

watchdog fires on every save, so the same file can get processed multiple times. A simple database (SQLite is fine) or file hash tracking can prevent this.


Summary

The core of this pipeline is deciding the output format first. Once the format is set, prompt design and code implementation both flow naturally.

Rather than trying to automate everything from the start, a practical approach is to begin with convert → review → manual publish, then switch to auto-publishing once quality is stable. AI conversations, when organized, have more than enough quality to become blog posts. It's a shame to let them get buried.