What This Automation Does
This workflow collects your WordPress posts and pages that are live and not locked by password.
It changes HTML text into Markdown, then cuts it into small parts that fit an AI model’s limits.
These parts get turned into vectors — numbers that AI understands — and saved in a Supabase table.
There is also a Postgres database ready to remember chat talks with visitors.
You get a webhook chat interface where customers ask questions, and the AI answers using the latest site content.
This stops old content being used and saves you hours of manual work every time site content changes.
Who Should Use This Workflow
This workflow is for users who manage WordPress sites and want a smart chatbot that knows recent content.
If coding or manual updates confuse you, this automation helps by doing all content fetching, processing, and embedding automatically.
You also need to be okay with setting API keys and credentials in n8n for WordPress, OpenAI, Supabase, and Postgres.
Tools and Services Used
- WordPress REST API: To get published posts and pages.
- OpenAI API: To create embeddings and chat completions.
- Supabase: Stores vector embeddings and tracks workflow runs.
- Postgres with pgvector: Keeps chat memory for context-aware conversations.
- n8n: Automates the whole process and runs the workflow.
- Langchain integration: Powers the AI chat agent and memory storage.
Inputs, Processing Steps, and Output
Inputs
- WordPress site with REST API access.
- OpenAI API key with embedding and chat permissions.
- Supabase project with tables for documents and embedding histories.
- Postgres database with pgvector extension enabled.
- n8n credentials configured for all services.
Processing Steps
- Fetch published posts and pages from WordPress.
- Filter out drafts and password-protected articles.
- Change HTML into Markdown format to keep text clean.
- Cut long texts into chunks of 300 tokens with 30-token overlap for embeddings.
- Format chunks as documents with metadata for context.
- Use OpenAI to generate vector embeddings for each chunk.
- Save vectors and metadata into Supabase vector store.
- Record workflow run times in Supabase for incremental updates.
- On schedule, fetch only changed documents since last run.
- Delete old embeddings for updated documents and insert new ones.
- When a chat message arrives, retrieve similar documents from Supabase.
- Use GPT-4o-mini with Postgres memory to reply to visitor questions, referencing content.
- Send AI-generated answer back through webhook response.
Output
Fresh vector embeddings stored in Supabase.
Updated chat memory in Postgres for better AI dialog.
Chat answers wired to a webhook ready for visitor interaction.
Beginner Step-by-Step: How to Use This Workflow in n8n
Step 1: Download and Import Workflow
- Click the Download button on this page to get the workflow file.
- Open your n8n editor.
- Use the “Import from File” option to load this workflow.
Step 2: Configure Credentials and Settings
- Add your WordPress API credentials in the nodes named WordPress – Get all posts and WordPress – Get all pages.
- Enter your OpenAI API key in nodes Embeddings OpenAI and AI Agent.
- Update Supabase API credentials in Supabase Vector Store and related nodes.
- Set Postgres database connection details in the chat memory nodes.
- Check metadata IDs or table names in nodes like Supabase – Store documents on Supabase and update if needed.
Step 3: Test the Workflow
- Run the workflow once manually by clicking “Execute Workflow” in the n8n editor.
- Watch the output and check that posts, pages, and embeddings are processed without errors.
Step 4: Activate for Production
- Switch the workflow status to “Active” to enable scheduled triggers.
- Use the webhook URL from the When chat message received node as your chat interface endpoint.
Note: If hosting n8n on your server or VPS, check self-host n8n for stable operation.
Customization Ideas
- Change token chunk size or overlap in Token Splitter nodes to balance speed and memory.
- Try higher-quality OpenAI models like “text-embedding-3-large” or GPT-4o in embedding and chat nodes.
- Add filters to include custom post types or tags in Filter – Only published & unprotected content.
- Write your own AI agent prompt in AI Agent to tailor responses by role or language.
- Set error handling around API calls for retries or sending failure alerts.
Common Issues and Fixes
- WordPress API authorization fails
Make sure WordPress API credentials are correct and REST API is enabled. - Embeddings empty or wrong
Check that the HTML to Markdown conversion outputs valid text and that chunks have content before embedding. - Chat returns no answers
Verify Supabase documents table has vectors and the index is not corrupted; rerun embedding if needed. - Workflow runs too often and hits API limits
Increase the scheduled trigger interval beyond 30 seconds to reduce calls.
Pre-Production Checklist
- Verify WordPress API connection by testing data retrieval nodes.
- Confirm Supabase tables exist with correct permissions.
- Test OpenAI keys in embeddings and chat nodes.
- Run manual trigger for initial full embedding.
- Send test chat messages to check AI replies via webhook.
- Backup your Postgres and Supabase data before scheduling workflow runs.
Deployment Guide
Turn on the workflow in n8n by setting status to Active.
Adjust the schedule trigger time according to how often the WordPress site updates new content.
Watch logs and Supabase inserts to catch error early.
Use the webhook URL from the When chat message received node to connect your chat frontend.
Summary
✓ Automatically keeps WordPress content updated in AI embeddings and chat memory.
✓ Saves time by removing manual syncing steps.
✓ Uses AI to give visitors accurate answers with latest site info.
✓ Runs inside n8n with scheduled and manual triggers.
✓ Works with WordPress REST API, OpenAI, Supabase, and Postgres memory.
→ Result is a live chatbot that understands your website content and updates itself without extra effort.
