WordPress Integration & Knowledge Base Training
Chatty provides a complete, dual-purpose WordPress Integration under Dashboard → Integrations → WordPress Content & KB:
- 1-Click Knowledge Base Training: Automatically fetch and train your AI agent on all published WordPress Pages, Blog Posts, and Articles via the WordPress REST API (
/wp-json/wp/v2) or Sitemap XML fallback—with clickable source URL citations in every answer. - Real-Time Auto-Sync & Widget Embed: Embed the responsive Chatty widget on your WordPress site and automatically push real-time content updates (
save_post) to your Knowledge Base whenever you publish or edit a page or post.
Part 1: Training Your AI on WordPress Content
You do not need to copy-paste WordPress pages or blog posts one by one into your Knowledge Base.
Step 1: Connect Your WordPress Site
- Open Chatty Dashboard → Integrations → WordPress Content & KB.
- Enter your WordPress Website URL (e.g.,
https://yourwebsite.com). - Choose which content types to train:
- Train AI on Published Pages (
/wp-json/wp/v2/pages— About, Pricing, Services, FAQ, Policies) - Train AI on Blog Posts & Articles (
/wp-json/wp/v2/posts— Guides, News, Documentation, Tutorials)
- Train AI on Published Pages (
- (Optional) If your WordPress REST API is restricted behind authentication, click + Optional: Add WP Application Password and enter your WordPress Username and an Application Password generated under WordPress Admin → Users → Profile → Application Passwords.
- Click Connect & Train Knowledge Base.
Step 2: How Content Is Indexed in Your Knowledge Base
When you connect or click Sync Content Now:
- Chatty paginates through your published WordPress Pages and Posts via
/wp-json/wp/v2/pagesand/wp-json/wp/v2/posts(or falls back to/wp-sitemap.xmlif a security plugin disables REST routes). - Gutenberg blocks, shortcodes, scripts, and HTML tags are stripped into clean, structured Markdown text containing the page title, canonical URL, last-modified timestamp, summary excerpt, and full article body.
- Each page or post is upserted directly into your bot's Knowledge Base (
chatty_sourceswithtype="url"andstatus="trained"). - You can inspect, search, or manage every imported WordPress page at any time inside Dashboard → Knowledge Base.
Part 2: Optional Real-Time Content Auto-Sync (save_post Webhook)
What happens when you publish a new blog post, update your pricing page, or trash an outdated article on WordPress?
Once your WordPress site is connected inside Dashboard → Integrations → WordPress Content & KB, Chatty provides an optional Real-Time Content Webhook (save_post) pre-configured with your webhook_url and HMAC-SHA256 webhook_secret.
How to Enable Real-Time Content Sync in WordPress:
- In your WordPress Admin, install the free WPCode (Code Snippets) plugin, or open Appearance → Theme File Editor →
functions.php. - Copy the
save_postHook from your connected Chatty WordPress Integration card:
<?php
/**
* Chatty AI — Real-Time WordPress Knowledge Base Auto-Sync Hook
* Automatically updates your Chatty Knowledge Base whenever a Page or Post is published or edited.
*/
add_action('save_post', function ($post_id, $post, $update) {
if (wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) return;
if (!in_array($post->post_type, array('post', 'page'), true)) return;
$payload = wp_json_encode(array(
'action' => $post->post_status === 'publish' ? 'updated' : 'deleted',
'id' => $post_id,
'post_type' => $post->post_type,
'post_status' => $post->post_status,
'title' => get_the_title($post_id),
'link' => get_permalink($post_id),
'content' => apply_filters('the_content', $post->post_content),
'excerpt' => get_the_excerpt($post_id),
'modified' => $post->post_modified_gmt,
));
$signature = hash_hmac('sha256', $payload, 'YOUR_WEBHOOK_SECRET');
wp_remote_post('https://api.chatty.personaliai.com/api/integrations/wordpress/webhook/YOUR_BOT_ID', array(
'method' => 'POST',
'timeout' => 5,
'blocking' => false,
'headers' => array(
'Content-Type' => 'application/json',
'X-WP-Chatty-Signature' => $signature,
),
'body' => $payload,
));
}, 10, 3);- Save and activate the snippet:
- Instant Knowledge Base Sync: Publishing or editing any Page or Post fires a non-blocking, HMAC-signed webhook to
/api/integrations/wordpress/webhook/{bot_id}that updates the trained source in your Knowledge Base within seconds. Unpublishing or moving a post to Trash automatically removes it from your AI's Knowledge Base.
- Instant Knowledge Base Sync: Publishing or editing any Page or Post fires a non-blocking, HMAC-signed webhook to
Part 3: Embedding the Chat Widget (Official WordPress Plugin)
To embed the floating Chatty widget or inline chat window on your WordPress site, use the Official WordPress Plugin found under Dashboard → Integrations → Embed Chatbot on Websites → WordPress:
Method A: Plugin Directory
- Navigate to Plugins → Add New Plugin in your WP Admin.
- Search for
PersonaliAI Customer Support Chatbot. - Click Install Now, then Activate.
View on WordPress.org →
Method B: Shortcode Embeds
Embed an inline chat window inside any Gutenberg block, Elementor section, or Divi layout:
[personaliai_chat inline="true" height="650px" width="100%"]
If your WordPress site also runs WooCommerce for e-commerce products and order tracking, connect both WordPress Content & KB (for your informational pages, policies, and blog articles) and WooCommerce Store (for live product cards, variations, and order lookups).