=== Chatbot IO Widget ===
Contributors: victhedev
Tags: chatbot, ai, widget, customer support, woocommerce
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Official WordPress client for bestchatbot.io. AI chat widget with identity verification for protected actions.

== Description ==

Chatbot IO Widget is the official WordPress client for the bestchatbot.io service. It adds an AI-powered chat widget to your WordPress site. The widget uses your knowledge base to answer visitor questions, and can execute real actions like scheduling appointments, creating support tickets, and looking up orders.

**Features:**
* AI chat widget powered by your knowledge base (RAG)
* Identity verification for logged-in users (JWT-based)
* WooCommerce integration: enriches identity with billing data and Stripe customer ID
* Cache-safe: works with WP Rocket, W3 Total Cache, Cloudflare, and all page caching plugins
* Zero friction for anonymous visitors (identity only required for protected actions)

**How Identity Verification Works:**
1. The widget loads normally on all pages (no token in HTML)
2. A background AJAX request checks if the visitor is logged in
3. If logged in, a signed JWT token is generated server-side and passed to the widget
4. The token enables protected actions (order lookup, subscription check, etc.)

This approach is cache-safe because the AJAX endpoint (admin-ajax.php) is never cached by WordPress caching plugins.

**Third-Party Service:**
This plugin requires a bestchatbot.io account to function (SaaS). The widget connects to the bestchatbot.io service at https://bestchatbot.io to process conversations, run the knowledge base (RAG) pipeline, and execute tool calls. By installing this plugin you agree to the bestchatbot.io Terms of Service and Privacy Policy: https://bestchatbot.io/terms

== Installation ==

1. Upload the `chatbot-io-widget` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to Settings > Chatbot IO Widget
4. Enter your API Key (from bestchatbot.io Dashboard > Widget > Installation)
5. Enter your Signing Key (from bestchatbot.io Dashboard > Widget > Security)
6. Save; the widget is now active on all public pages

== Frequently Asked Questions ==

= Do I need WooCommerce? =
No. The plugin works with any WordPress site. WooCommerce integration is automatic if WooCommerce is installed.

= Is it compatible with caching plugins? =
Yes. The identity token is obtained via AJAX (admin-ajax.php), which is never cached.

= What data is included in the identity token? =
Email, display name, and user ID. With WooCommerce: billing email, phone, and Stripe customer ID (if available).

== Screenshots ==

1. AI chat widget running on a WooCommerce store; answers product questions and handles customer requests like order cancellations.
2. Logged-in visitor with verified identity; the bot recognizes the customer via JWT and retrieves their order details securely without exposing data to unauthenticated visitors.

== Changelog ==

= 1.0.0 =
* Initial release
* Widget script enqueued via wp_enqueue_script + wp_add_inline_script (wp.org compliant)
* Cache-safe identity verification via admin-ajax.php
* WooCommerce billing data enrichment
* Admin settings page with status panel
