MsgHub WordPress plugin install
The MsgHub WordPress plugin drops the AI chat widget on any WordPress site in under 5 minutes — no theme edits, no FTP, no developer needed. Auto-detects logged-in users, plays nicely with WooCommerce, survives caching plugins. This guide covers install, configuration, and the most common gotchas.
Overview
The plugin is a thin wrapper around the MsgHub chat widget snippet — but with WordPress-native conveniences:
What the plugin actually does
It loads the MsgHub widget script (https://app.msghub.info/api/v1/widget.js) with your tenant's API key, applying display rules and identification data you've configured. That's it — small footprint, no shadow database, no PHP-side message processing.
Prerequisites
- WordPress 5.5 or newer. Older versions may work but aren't tested.
- Admin access to the WordPress site.
- A MsgHub tenant with the Chat Widget enabled in Settings and a tenant API key generated from the API Keys sidebar item.
- An HTTPS-enabled site (the widget script requires HTTPS).
Install
Option A · Install from WordPress plugin directory
- WordPress admin → Plugins → Add New.
- Search box: type "MsgHub".
- Find MsgHub AI Chat Widget → click Install Now.
- Wait for the install to complete (~10 seconds).
Option B · Upload ZIP manually
Use this method if the directory listing is unavailable in your region or you want a specific version.
- Download the latest plugin ZIP from plugin.msghub.info.
- WordPress admin → Plugins → Add New → Upload Plugin.
- Choose the ZIP file → Install Now.
Activate
Click Activate
After install completes, click Activate. A new MsgHub menu item appears in your WordPress sidebar.
If you don't see the menu item, refresh the admin page once.
Configure the plugin
Paste your tenant API key
- WordPress admin → MsgHub → Settings.
- In MsgHub (separate tab): sidebar → API Keys → + New API Key. Name it e.g. "WordPress widget", tick scopes
contacts:writeandmessages:send. Copy the key (formatmh_live_…) — shown only once. - Also confirm the Chat Widget is enabled: Settings → Chat Widget section → Enabled checkbox is ticked.
- Back in WordPress, paste the API key into the plugin Settings page.
- Click Save Changes.
Haven't configured the Chat Widget yet? Follow the Web Chat Widget setup first — it's just a Settings page section to enable + customise.
Set display rules
By default the widget appears on every page. To control where:
- Show on: All pages / Specific post types / Specific pages / URL patterns.
- Hide on: Checkout page, thank-you page, admin pages. Recommended hides:
checkout,order-received,my-account/orders. - Roles: show only to specific WordPress roles, or hide from logged-in admins (often useful so admins aren't bothered by their own widget).
| Common rule | Setting |
|---|---|
| Hide on checkout | Hide on: pages containing "checkout" or "order" |
| Show only on product pages | Show on: post type product |
| Hide from admins | Hide for roles: administrator, editor |
| Show on landing pages only | Show on URLs matching /landing/* |
Appearance overrides
Most appearance settings live in MsgHub (colour, position, welcome message). The plugin lets you override per-site:
- z-index — bump above stubborn theme elements (default 999999).
- Bottom offset — push above floating WhatsApp buttons or cookie banners.
- Auto-open on first visit — appears 3 seconds after page load. Use sparingly; can annoy.
- Show on mobile — disable widget below a breakpoint if your mobile design is tight.
Logged-in user identification
One of the most valuable features. When a WordPress user is logged in, the plugin passes their name and email to MsgHub automatically — no pre-chat form needed.
- Toggle Identify logged-in WordPress users ON.
- Pick which user meta fields to send:
display_name | → Contact name in MsgHub |
user_email | → Contact email |
billing_phone (WooCommerce) | → Contact phone |
ID | → Stored as custom attribute wp_user_id |
| Custom user meta | Any user meta key you specify |
If the user has previously chatted as a guest, MsgHub merges the guest history into the identified contact record — no lost history.
WooCommerce integration
If WooCommerce is installed and active, the plugin auto-detects it and surfaces commerce context to the AI:
- Cart contents — passed as session metadata; AI can answer "what's in my cart?".
- Order history — last 10 orders linked to the contact. AI answers "where's my order #4821?".
- Customer lifetime value — total spend; used for VIP routing rules.
- Currently viewed product — when widget is opened on a product page, the AI knows which product the customer is asking about.
Enable from MsgHub → Settings → WooCommerce tab. Granular toggles for each data type.
WooCommerce hook example: after an order completes, the plugin can auto-fire a "thanks for your order" message to the customer's WhatsApp (if they shared a number). Configure under WooCommerce → Order events.
Caching plugin compatibility
Aggressive caching plugins can break logged-in user identification by caching the widget snippet with a previous user's data. The plugin handles this correctly, but for caches with custom rules, configure:
| Cache plugin | Setting |
|---|---|
| WP Rocket | Cache → Advanced → User Cache → enable. Or exclude the widget script from JS optimisation. |
| W3 Total Cache | Performance → User Agent Groups → ensure logged-in users get separate cache. |
| LiteSpeed Cache | Cache → Browser → exclude pages with logged-in identification. |
| Cloudflare APO | Bypass cache for logged-in users (default behaviour with APO + WordPress). |
| Hostinger LiteSpeed | Same as LiteSpeed — exclude logged-in cache. |
Test it live
Verify in incognito
- Open your site in an incognito / private window (so you're not logged in).
- You should see the chat bubble in the corner.
- Click → welcome message appears.
- Send a test message → check MsgHub Inbox → Web Chat channel.
Verify logged-in identification
- Login to WordPress as a regular customer.
- Visit a front-end page → click the chat bubble.
- Send a message.
- In MsgHub Inbox: the conversation should show the customer's WordPress username and email, not "Anonymous visitor".
Shortcodes & programmatic control
Trigger from a button
[msghub_chat_button text="Chat with us"]
Renders a styled button. Clicking opens the chat widget.
Open with a pre-filled message
[msghub_chat_button text="Ask about this product" prefill="I have a question about {product_name}"]
WooCommerce-aware placeholders: {product_name}, {product_price}, {order_id}.
From custom JavaScript
// Open the widget MsgHubWidget.open(); // Open with a pre-filled message MsgHubWidget.open({ prefill: 'I want to schedule a demo' }); // Pass extra metadata about the visitor MsgHubWidget.identify({ customer_id: 'CUST-4821', segment: 'enterprise-trial', source: 'google-ads-campaign-spring' });
Troubleshooting
Widget doesn't appear after install + activate
- API key wasn't pasted or pasted with whitespace. Re-paste and Save.
- Display rule is hiding it (e.g. on all pages). Check Settings → Display Rules.
- Site is on plain HTTP. The widget requires HTTPS — install an SSL cert (Let's Encrypt is free).
- The widget domain (in MsgHub Settings) doesn't match your WordPress site domain. Add both
www.and bare versions.
Widget appears but won't open when clicked
- A theme element has a higher z-index. Increase plugin's z-index setting to 9999999.
- A JavaScript error in another plugin is breaking the page. Check browser console (F12).
- Cache served stale widget script. Clear cache plugin's cache.
Logged-in user shows as "Anonymous" in MsgHub
- Identification toggle is off in plugin Settings.
- Cache plugin served the non-logged-in version of the page. See caching section.
- Cloudflare or CDN serving cached HTML. Bypass cache for logged-in users.
WooCommerce orders not appearing in chat context
- WooCommerce integration toggle is off. Settings → WooCommerce → enable.
- Plugin version is older than 1.4 (WooCommerce support added in 1.4). Update from Plugins page.
- Customer has placed orders as guest, not logged-in user. Guest orders aren't linked.
Widget conflicts with other chat plugins
- Position overlap — change MsgHub to bottom-left, leave the other one at bottom-right (or vice versa).
- Both widgets fighting for z-index — disable one. Running two live chat widgets at once usually hurts conversion anyway.
"Failed to load widget script" error in console
app.msghub.infois blocked by an ad blocker or browser extension. Test in a clean profile.- A security plugin (Wordfence, Sucuri) is blocking outbound to
app.msghub.info. Whitelist the domain.
FAQ
Is the plugin free?
Yes. The plugin itself is free on the WordPress directory. You need an active MsgHub tenant to use it. See pricing for tenant plans.
Does it work with WordPress.com hosted sites?
Only on Business plan and above (which allows custom plugins). WordPress.com Free and Personal don't support third-party plugins. Self-hosted WordPress (WordPress.org) always works.
Does it slow down my site?
No. The plugin enqueues a single small script (~24 KB gzipped) loaded asynchronously. It doesn't add database queries on the front-end, doesn't load on admin pages, and doesn't run unnecessarily. Lighthouse impact is negligible — typically <1 point.
Can I use it on a multisite WordPress network?
Yes. Network-activate the plugin, then configure per-site under each site's MsgHub Settings. Each site can have its own widget (separate MsgHub API key) or share one.
Will it work with my page builder (Elementor / Divi / Bricks)?
Yes — the widget is appended to the page body and is independent of your builder. The shortcode [msghub_chat_button] can be inserted via any builder's shortcode widget for trigger buttons.
Can I use multiple widgets on different parts of the site?
The plugin supports one widget per site (most sites want consistency). If you need different widgets per section, embed each via the raw HTML snippet on specific pages and disable the plugin's auto-inject globally.
Is my data sent to any third party other than MsgHub?
No. The plugin only communicates with app.msghub.info and your own WordPress database. No third-party analytics, no telemetry, no ads. See security architecture.