Aller au contenu
01

How to create an AI chatbot for your WordPress site

Creating an AI chatbot for your WordPress is no longer reserved for large companies. This guide explains the RAG method, the tools (Claude AI, n8n), and the step-by-step integration into WordPress.

Walid Sadfi
3 min reading
Share:

A modern AI chatbot for WordPress is no longer just a decision tree with pre-programmed responses. It is an intelligent assistant powered by an LLM (Claude AI, GPT-4) and fed by your content, which understands questions in natural language and responds accurately using YOUR data. Here’s how to create one.

The components of a WordPress AI chatbot

  • The LLM, The language model (Claude AI, GPT-4 or Mistral) that understands and generates text
  • The knowledge base, Your pages, articles, FAQs and documentation, indexed in a vector database
  • The RAG (Retrieval-Augmented Generation), The system that searches for passages relevant to each question
  • The chat interface, A widget integrated into your WordPress site, responsive and customised to match your brand guidelines
  • The backend, an API that orchestrates the RAG + LLM (n8n, Make, or custom code)

Step 1: Choosing your LLM

Claude AI (Anthropic), Our top recommendation. Excellent in French, secure, accurate and honest about its limitations. API available from 3 $ per million tokens. Perfect for support and lead qualification chatbots.

GPT-4 (OpenAI), Highly creative, multi-modal, broad scope. Slightly more expensive. US servers – check GDPR compliance depending on your use.

Mistral Large, Open-source, hosting in the EU available. Excellent for French. Ideal if your data is sensitive and you want maximum GDPR compliance.

Step 2: Building the knowledge base

  1. Export your WordPress content (posts, pages, FAQs) using WordPress’s native XML export feature
  2. Clean up the content (remove HTML, normalise)
  3. Split into «chunks» of 500 to 1000 tokens
  4. Generate embeddings (numeric vectors) via the OpenAI or Cohere API
  5. Store in a vector database (Pinecone, Chroma, or pgvector if self-hosted)

Step 3: Set up the RAG with n8n

  1. n8n workflow: Webhook (user question)
  2. Node: Generate the embedding for the question
  3. Node: Find the 5 nearest chunks in Pinecone
  4. Node: Construct the prompt using context + question
  5. Node: Send to Claude AI API
  6. Node: Return the response to the chat widget

Step 4: Embed the widget in WordPress

Option 1: Create a WordPress shortcode that loads a custom JavaScript widget (floating button, chat window, opening animation).

Option 2: Use Crisp, Intercom or Tidio as your chat interface, and integrate your RAG + LLM backend as a custom bot via their API.

Option 3: Use a turnkey solution such as Voiceflow or Botpress, which offer no-code interfaces and can be integrated with WordPress in 5 minutes.

Step 5: Test and calibrate

  • Manually test over 100 typical questions from your visitors
  • Check that the bot responds with «I don’t know» to topics outside its scope (no hallucinations)
  • Adjust the system instructions (tone, limits, recommended CTAs)
  • Set up human escalation for complex cases

Expected results

  • 80 %: frequently asked questions resolved without human intervention
  • Average response time: 2–3 seconds (compared with 2–4 hours for a human)
  • Available 24 hours a day, 7 days a week, 365 days a year
  • +20 to +35 % qualified leads (the chatbot collects the information before passing it on)

Would you prefer us to do it for you? Discover our AI chatbot service for WordPress →

Author

Walid Sadfi

WordPress, AI & SEO expert at Evolurise.