=== ChatUI Widget for n8n ===
Contributors: digitalmeactivecampaign
Tags: chat, chatbot, n8n, widget, live chat
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds your N8N Chat UI chat widget to your WordPress site and lets you hide it on the pages you choose.

== Description ==

Connect the chat widget you built at n8nchatui.com to your WordPress site in one step. Enter your Widget ID, save, and the widget appears on every page. No code to paste.

Running a standalone widget that talks to your own n8n workflow? Enter the n8n webhook URL instead and pick the button colour, size, window title and welcome message from plain fields.

Need it hidden somewhere? Either list pages under Settings > N8N Chat UI (by path, slug, ID or wildcard), or tick "Hide chat widget on this page" while editing any page or post.

**Features**

* Managed widgets: enter the Widget ID (or the embed URL) and you are done
* Standalone widgets: enter the n8n webhook URL and style the button and window from settings fields
* Exclude pages by URL path, wildcard pattern, slug, ID or the front page
* Per-page "Hide chat widget" checkbox in the editor sidebar
* Choose whether the script loads in the header or the footer
* No user-supplied code is stored or printed; the front-end script ships with the plugin and reads its settings as data
* Clean uninstall: removes its own settings and page flags

== External services ==

This plugin displays a chat widget provided by N8N Chat UI (n8nchatui.com). To do that it loads the widget code from N8N Chat UI's servers on every front-end page where the widget is enabled, and the widget then exchanges chat messages with the chatbot backend.

**Managed widgets (Widget ID)**

The plugin loads the widget script from `https://proxy.n8nchatui.com/api/embed/{your-widget-id}` on each page where the widget is shown. The request carries the standard information any browser sends when loading a script: the visitor's IP address, user agent, and the page URL as the referrer. Messages typed into the chat, and any files a visitor attaches, are sent to N8N Chat UI, which forwards them to the n8n workflow you connected in your N8N Chat UI dashboard. Chat history is kept in the visitor's browser local storage by the widget so the conversation survives a page reload.

**Standalone widgets (n8n webhook URL)**

The plugin loads the widget script from `https://cdn.n8nchatui.com/v1/embed.js` on each page where the widget is shown; that request carries the visitor's IP address, user agent and the page URL as the referrer. Messages typed into the chat are sent directly from the visitor's browser to the n8n webhook URL you entered, which is a server you control, and N8N Chat UI does not receive them.

This service is provided by N8N Chat UI:

* Terms of service: https://n8nchatui.com/terms
* Privacy policy: https://n8nchatui.com/privacy

No data is sent to these services from the WordPress admin; requests only happen on front-end pages where the widget is displayed, and only from the visitor's browser.

== Installation ==

1. Upload the `n8n-chat-ui-widget` folder to `/wp-content/plugins/`, or install the ZIP from Plugins > Add New > Upload Plugin.
2. Activate the plugin.
3. Go to Settings > N8N Chat UI, enter your Widget ID (or, for a standalone widget, the n8n webhook URL) and click Save Changes.

Your Widget ID is the last part of the embed URL shown in your N8N Chat UI dashboard: `https://proxy.n8nchatui.com/api/embed/YOUR-WIDGET-ID`.

== Frequently Asked Questions ==

= Where do I find my Widget ID? =

In your N8N Chat UI dashboard, open your widget and look at the embed URL. The ID is the last part of `proxy.n8nchatui.com/api/embed/...`. You can paste the whole URL into the field and the plugin will pick the ID out of it.

= Can I paste the embed code? =

No. The plugin does not accept code. For a managed widget it only needs the Widget ID; for a standalone widget it needs the n8n webhook URL and, optionally, the colour, size and text settings offered on the settings page.

= How do I hide the widget on some pages? =

Go to Settings > N8N Chat UI and add one entry per line under "Exclude pages". Accepted formats:

* `/checkout` a URL path
* `/blog/*` a path with a wildcard
* `contact` a page or post slug
* `42` a page or post ID
* `home` the front page

Or open the page in the editor and tick "Hide chat widget on this page" in the sidebar.

= I have a standalone widget with my own webhook URL. Can I use it? =

Yes. Leave the Widget ID empty, enter the n8n webhook URL under "Standalone widget" and adjust the button and window fields if you like.

== Changelog ==

= 1.0.0 =
* First release.
