n8n

How to Sync WordPress and Supabase AI Chat?

Make your website content easy to chat with. The flow scans WordPress posts and pages, builds a vector index in Supabase, and serves answers through an AI chat. It suits marketing teams and content owners who want quick, trusted replies pulled from their own articles.

On the first run, tables are created and all content is loaded. A schedule checks WordPress for changes and only pulls items updated since the last run. Published and unprotected pages are converted from HTML to clean text, split into small chunks, and turned into embeddings with OpenAI. The data is stored in Supabase, and smart logic upserts records so edits replace old vectors. When a chat message arrives, related documents are fetched from Supabase and passed with metadata to a chat model. Postgres stores the chat memory so replies keep context, and the answer is returned by webhook.

Set credentials for WordPress, Supabase, PostgreSQL, and OpenAI. Adjust the schedule to match how often you publish. Expect strong time savings on content indexing and fewer support questions, while visitors get clear answers based on your site. Use it for content search, pre sales FAQs, and training pages that need a helpful chat layer.

What are the key features?

  • Initial load creates tables and builds the first vector index from all posts and pages.
  • Scheduled checks pull only content modified after the last execution to keep data fresh.
  • Filters include only published and unprotected items to avoid private data.
  • HTML is converted to clean text and split into small chunks for better search quality.
  • Embeddings are created with an OpenAI embedding model and stored in Supabase.
  • Upsert logic deletes and reinserts vectors when a document changes.
  • Similarity search retrieves the most relevant documents for each chat message.
  • Chat runs on an OpenAI chat model and uses Postgres memory to keep the conversation context.
  • Webhook returns the final AI reply to your site or front end.
  • Execution history is saved to track runs and support reliable incremental updates.

What are the benefits?

  • Reduce manual indexing from hours to minutes by auto loading and chunking site content.
  • Automate over 90% of update checks by only pulling WordPress items changed since the last run.
  • Improve answer accuracy by grounding the chat on your published pages and posts.
  • Handle up to 10 times more chat questions with vector search and chat memory.
  • Unify WordPress, Supabase, PostgreSQL, and OpenAI in one flow without glue code.
  • Prevent duplicate records with smart upsert logic that replaces outdated vectors.

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with WordPress, Supabase, PostgreSQL and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, open any WordPress node, choose Credential to connect with, click Create new credential, then follow the on screen steps to connect your site. Use a WordPress application password or your preferred method.
  4. For Supabase, open the Supabase Vector Store and any Supabase nodes, create new credentials, and enter your project URL and API key from the Supabase dashboard.
  5. For PostgreSQL, open each Postgres node, create new credentials, and provide host, port, database, user, and password for your database. Ensure the user can create tables if you plan to run the table creation nodes.
  6. For OpenAI, open the Embeddings and Chat Model nodes, create new credentials, and paste your API key from the OpenAI account page.
  7. Run the table creation nodes for documents and workflow history if your databases are empty. Trigger them once and confirm the tables exist.
  8. Configure the WordPress fetch nodes for posts and pages. Keep the filters to include only published and unprotected items.
  9. Check the Token Splitter settings. The default chunk size and overlap work well for most sites, but you can tune for your content length.
  10. Adjust the schedule node to match your publish rate. For most teams a few minutes is enough. Avoid very short intervals if your site is large.
  11. Start an initial full run using the manual trigger. Verify new vectors appear in your Supabase project and that execution history is stored.
  12. Test the chat path using the chat trigger or webhook test function. Confirm that related documents are returned and the AI reply references your content.
  13. If you see duplicates or stale data, review the Switch node and the Postgres filter path. Confirm that the delete then insert upsert path is active for updated posts.
  14. Monitor errors in n8n. Common issues include invalid API keys, missing database permissions, and WordPress access rules. Fix credentials and rerun.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

PostgreSQL

Sign up

Free: $0 (open-source PostgreSQL License; self-hosted)

Supabase

Sign up

Free: $0 / mo — unlimited API requests; 500 MB database; 5 GB bandwidth; 1 GB storage; 50,000 MAUs.

WordPress

Sign up

Free plan: $0 / mo (WordPress.com REST API supports creating posts)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.