=== WebMate AI Assistant ===
Contributors: oguzhancem
Donate link: https://cyucel.tr/projeler/aichatwordpressplugin
Tags: ai, chatbot, openai, customer support, lead generation
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.2.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A professional, glassmorphic AI chatbot for WordPress. Bring your own API key, capture leads, track costs, and engage visitors 24/7 — no monthly SaaS fees.

== Description ==

**WebMate AI Assistant** turns your WordPress site into a 24/7 AI-powered support and lead generation engine. Unlike SaaS chatbot services that charge monthly fees and own your data, WebMate connects directly to your own AI provider account — you pay only for what you use, and every conversation stays on your server.

Designed for clinics, law firms, consultancies, agencies, e-commerce stores, and any service-oriented business that wants to capture leads and answer visitor questions automatically.

[Learn more about WebMate AI Assistant](https://cyucel.tr/projeler/aichatwordpressplugin)

= Why WebMate AI Assistant? =

* **No monthly SaaS fees** — connect your own OpenAI, Anthropic, or Gemini API key and pay only for actual usage
* **Your data stays yours** — all conversations and leads are stored in your own WordPress database
* **Works with any AI model** — GPT-4o, Claude 3.5, Gemini 1.5, Llama, Mistral, or any OpenAI-compatible API
* **Zero coding required** — a guided setup wizard gets you running in under 5 minutes
* **GDPR-friendly** — no third-party tracking, no external analytics, full data ownership

= Key Features =

**AI & Providers**
* OpenAI (GPT-3.5, GPT-4, GPT-4o, o1 and beyond)
* Anthropic Claude (Claude 3 Haiku, Sonnet, Opus, Claude 3.5)
* Google Gemini (1.0 Pro, 1.5 Pro, 1.5 Flash)
* Azure OpenAI Service with custom deployment URLs
* Any OpenAI-compatible endpoint (Ollama, Together AI, Groq, OpenRouter, and more)
* WordPress 7.0+ AI Client — uses the site-wide provider configured in Settings > Connectors

**Knowledge Base**
* Teach the AI about your business by adding URLs — the plugin fetches and indexes your pages automatically
* Manual knowledge entries for custom Q&A pairs, policies, or product details
* Scheduled auto-learning (daily or weekly) to keep the knowledge base fresh

**Lead Generation & Engagement**
* Built-in contact collection form shown after a natural conversation threshold
* Star-rating form to capture visitor satisfaction scores
* Idle-trigger message to re-engage visitors who have been on the page for a set time
* Extra floating action button (WhatsApp, Telegram, phone, email, Instagram) shown next to the chat launcher

**Customization**
* Fully customizable chat widget color, launcher icon (SVG or emoji), position (bottom-left / bottom-right)
* Custom system prompt to define the AI's personality, tone, and scope
* Custom welcome message and trigger message
* Page-based visibility: show on all pages, selected pages only, or exclude specific pages
* Shortcode `[webmate_ai_widget]` for manual placement anywhere

**Admin & Reporting**
* Session list with full conversation history and export to CSV
* Token usage and estimated USD cost per session and in aggregate
* Spam guard and profanity filter to block abuse
* Delete empty or old sessions in bulk

= Perfect For =

* **Clinics & healthcare** — answer appointment and service questions around the clock
* **Law firms & consultancies** — pre-qualify leads before a human follows up
* **E-commerce** — help shoppers find products and answer policy questions
* **Agencies & freelancers** — showcase AI on client sites and differentiate your offering
* **SaaS & tech** — provide instant first-level support without a live agent

= Privacy & Data =

All conversation data, leads, and session logs are stored exclusively in your own WordPress database. The only data sent externally is the chat message itself, forwarded to the AI provider you choose. See the **External services** section below for full disclosure.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/webmate-ai-assistant/` or install directly from the WordPress Plugin Directory.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **WebMate AI > Quick Setup** and follow the step-by-step wizard.
4. Enter your API key under **WebMate AI > Settings** (WordPress < 7.0), or configure the AI provider under **Settings > Connectors** (WordPress 7.0+).
5. Customise the widget color, icon, welcome message, and visibility options — then save.

The chat widget will appear on your site immediately after saving. No page builders or theme modifications are needed.

== Frequently Asked Questions ==

= Do I need my own API key? =

On WordPress versions older than 7.0, yes — you will need an API key from OpenAI, Anthropic, Google, or another supported provider. Your key is encrypted using AES-256 before being stored in the database. On WordPress 7.0 or newer, the plugin can use the built-in AI Client and the credentials you configure under Settings > Connectors, so you only need to set it up in one place.

= How much does it cost to run? =

There is no fee to use the plugin itself. You pay only for the AI API calls you make. For a typical small business handling a few hundred conversations per month, costs are usually well under $5/month on GPT-4o-mini or Gemini Flash. You can monitor token usage and estimated costs per session directly in the WebMate AI admin.

= Which AI providers are supported? =

OpenAI, Azure OpenAI, Anthropic Claude, Google Gemini, and any provider that uses the OpenAI-compatible chat completions API format (including Ollama, Groq, Together AI, OpenRouter, and self-hosted models). On WordPress 7.0+, any connector registered with the WordPress AI Client is also supported.

= Can I limit which pages the chatbot appears on? =

Yes. Under **WebMate AI > Settings > Visibility**, you can choose to show the widget on all pages, only on specific pages you select, or on all pages except a list you exclude.

= Is the chatbot mobile-friendly? =

Yes. The chat widget is fully responsive and adapts to all screen sizes — desktop, tablet, and mobile. On smaller screens the widget slightly reduces in size to avoid obscuring content.

= Can I use the widget in a specific location with a shortcode? =

Yes. Add `[webmate_ai_widget]` to any page, post, or widget area to embed the chat widget at a specific location instead of using the fixed floating launcher.

= Is my visitors' data sent anywhere? =

Only the text of the chat messages is sent to the AI provider you configure — nothing else. All session data, contact form submissions, and ratings are stored exclusively in your own WordPress database. See the **External services** section for provider-specific details.

= Does it work with caching plugins? =

Yes. The chat widget is loaded via JavaScript after the page renders, so it is compatible with all popular caching plugins (WP Rocket, W3 Total Cache, LiteSpeed Cache, etc.). No cache exclusions are needed.

= Can I white-label or resell this plugin? =

The plugin is released under the GPL-2.0-or-later license, so you are free to modify and redistribute it under the same terms.

== External services ==

This plugin connects to third-party AI services to generate chatbot responses. The service used depends on the provider you select in Settings (or the provider configured in WordPress 7.0+ Settings > Connectors). No data is sent to any external service until a visitor sends a chat message.

= OpenAI =
* **Service:** OpenAI API (api.openai.com)
* **What is sent:** chat messages, system prompt, model parameters (temperature, max tokens), and optional knowledge snippets from your knowledge base
* **When:** each time a visitor sends a message in the chat widget
* **Terms of service:** https://openai.com/policies/terms-of-use
* **Privacy policy:** https://openai.com/policies/privacy-policy

= Anthropic =
* **Service:** Anthropic API (api.anthropic.com)
* **What is sent:** chat messages, system prompt, model parameters
* **When:** each time a visitor sends a message
* **Terms of service:** https://www.anthropic.com/legal/commercial-terms
* **Privacy policy:** https://www.anthropic.com/legal/privacy

= Google Gemini =
* **Service:** Google Gemini API (generativelanguage.googleapis.com)
* **What is sent:** chat messages, system prompt, model parameters
* **When:** each time a visitor sends a message
* **Terms of service:** https://ai.google.dev/gemini-api/terms
* **Privacy policy:** https://policies.google.com/privacy

= Azure OpenAI / Custom endpoints =
When Azure OpenAI or a custom OpenAI-compatible endpoint is configured, the same chat data is sent to the endpoint URL you provide. You are responsible for ensuring that endpoint's terms and privacy policy meet your requirements.

= Automatic knowledge learning =
* **What is sent:** a server-side HTTP GET request to the URLs you add to the knowledge base
* **When:** manually via the Learn Now button, or on the daily/weekly schedule you configure
* **What is stored:** page title and extracted text content, saved in your local WordPress database only

= Data stored locally =
To provide sessions, lead tracking, and spam protection, the following data is stored in your WordPress database:
* A randomly generated session key (cookie-based identifier, no personal data)
* The page URL where the chat was opened
* Visitor browser user agent and IP address (for spam filtering)
* Chat messages and any contact/rating information voluntarily submitted by the visitor

This data never leaves your server except as described above. You should disclose this processing in your site's privacy policy.

== Screenshots ==

1. The glassmorphic chat widget in action on a live site — clean, modern design that fits any theme

== Changelog ==

= 1.2.0 =
* Added extra floating action button alongside the chat launcher (WhatsApp, phone, email, Telegram, Instagram presets with one-click setup)
* Fixed Custom API and Azure provider routing — these providers now always use direct API calls instead of being incorrectly routed through the WordPress AI Client
* Improved admin preset selector: inline vanilla JS ensures presets work reliably regardless of browser cache state
* Extra button no longer shows a dismiss/close control — it stays visible permanently

= 1.1.0 =
* Rebranded as WebMate AI Assistant
* Added WordPress 7.0+ AI Client integration as the preferred provider mechanism
* Documented all external AI services with terms and privacy policy links
* Fixed register_setting sanitize_callback configuration for all options
* Removed load_plugin_textdomain() — WordPress 4.6+ handles this automatically
* Fixed empty-session creation bug — sessions are now created only when a visitor sends a message
* Session list now defaults to sessions with actual conversations
* Added advanced session filters: message status, minimum message count, page URL
* Improved pagination using WordPress-style paginate_links()

= 1.0.5 =
* Initial public release
* Support for OpenAI, Azure OpenAI, Anthropic Claude, and Google Gemini
* Page-based visibility controls
* Knowledge base with automatic learning
* Lead generation, star ratings, and contact forms
* Token usage and cost tracking
* Admin session list with CSV export

== Upgrade Notice ==

= 1.2.0 =
Adds the extra floating action button feature and fixes a routing issue that could prevent Custom API and Azure providers from working correctly. Recommended for all users.

= 1.1.0 =
Major update — plugin renamed to WebMate AI Assistant, WordPress 7.0 AI Client support added, session management improved. Existing settings and conversations migrate automatically on activation.
