Who is this workflow for? Integrate an AI-powered chatbot into your WordPress website to elevate user experience. This workflow leverages Supabase for efficient content storage and OpenAI for advanced conversational abilities, all orchestrated through n8n automation..
What does this workflow do?
Workflow 1: Initial Embedding
Purpose: Generate and store embeddings for existing WordPress posts and pages.
Create Supabase Tables:
Documents Table: Stores content embeddings with 1536 dimensions using pgvector.
Workflow Execution History Table: Logs workflow executions with IDs and timestamps for managing upserts.
Retrieve and Merge Content:
Nodes: Fetch all posts and pages from WordPress and merge them.
Filter: Apply filters to exclude irrelevant content from embedding generation.
Prepare Content for Embedding:
Set Fields: Define necessary fields for embeddings and metadata.
Filter Content: Include only published and unprotected content.
HTML to Markdown: Convert content to Markdown to optimize embedding performance.
Generate and Store Embeddings:
OpenAI Node: Generate vector embeddings for the content.
Data Loader: Prepare and structure content for Supabase storage.
Token Splitter: Segment content to comply with token limits.
Aggregate and Store: Save embeddings in Supabase and log the workflow execution.
Note: Execute this workflow once for initial embedding. Future updates are managed by Workflow 2.
Workflow 2: Handle Document Upserts
Purpose: Manage updates and additions to website content, ensuring embeddings remain current.
Scheduled Retrieval:
CRON Job: Runs periodically to check for content changes.
Fetch Modified Content: Retrieve posts and pages updated since the last execution.
Prepare Updated Content:
Set Fields: Define necessary fields for new or updated content.
Filter Content: Ensure only relevant content is processed.
Process Updates and Additions:
Loop Over Items: Determine if content is new or existing.
Existing Content: Delete old embeddings and prepare for updates.
New Content: Set fields for embedding new entries.
Store Updated Embeddings:
HTML to Markdown: Convert updated content.
Supabase Vector Store: Save new or updated embeddings.
Update Execution History: Log the latest workflow execution.
Workflow 3: AI Chatbot Integration
Purpose: Enable chat functionality on your website using embedded content for accurate responses.
Handle User Input:
Receive Chat Message: Capture user queries through the chatbot interface.
Retrieve Relevant Documents: Use Supabase to fetch embeddings matching the user’s question.
Aggregate and Set Fields: Consolidate retrieved documents for processing.
Generate and Respond:
AI Agent: Utilize OpenAI to generate a relevant response based on retrieved content.
Respond to User: Send the AI-generated answer back to the user.
Store Conversation History: Log interactions for future analysis and improvement.
🤖 Why Use This Automation Workflow?
Enhanced User Interaction: Provide users with real-time, intelligent responses based on your website’s content.
Efficient Content Management: Automatically embed and update content embeddings, ensuring your chatbot always accesses the latest information.
Insightful Analytics: Gain valuable insights into user queries and interaction patterns to inform content strategy.
👨💻 Who is This Workflow For?
This workflow is ideal for:
WordPress Site Owners: Looking to incorporate advanced AI features without extensive development.
Content Managers: Seeking automated solutions to manage and optimize website content.
Developers: Interested in integrating AI-driven functionalities into WordPress using powerful tools like Supabase and OpenAI.
🎯 Use Cases
AI-Driven Customer Support: Deploy a chatbot that assists visitors by providing accurate information drawn directly from your website’s content.
Content Recommendation Engine: Offer personalized content suggestions to users based on their interactions and queries.
Internal Content Insights: Analyze the types of questions and topics users are interested in, helping you refine and expand your content strategy.
TL;DR
This n8n workflow template seamlessly integrates your WordPress site with Supabase and OpenAI to deliver a robust AI chatbot. By automating content embedding, handling updates efficiently, and enabling intelligent user interactions, this workflow enhances both user experience and content management on your website.