=== HybridAI Chatbot ===
Contributors: stephannoller
Tags: chatbot, ai chatbot, OpenAI, hybridai, live chat, hybrid chatbot, customer support, AI assistant, GPT, LLM
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.2
Stable tag: 1.3.5
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically integrates the HybridAI Chatbot into your WordPress site, allowing users to chat with an AI assistant powered by HybridAI.

== Description ==

HybridAI Chatbot is a powerful and flexible plugin that seamlessly integrates the **HybridAI Chatbot** into your WordPress website. This modern AI-powered solution combines the best of automated and human support to provide an exceptional user experience.

**Key Features:**
- 🤖 **Advanced AI Integration**: Powered by state-of-the-art LLMs including OpenAI's GPT models, Mistral, Perplexity and Google Gemini
- 📚 **Knowledge Base Integration**: Automatically crawls your website or accepts PDF uploads to provide context-aware responses
- 🔍 **WordPress Integration**: Seamlessly searches your blog posts and pages to provide relevant information to users
- 👥 **Human Takeover**: Smooth transition to human operators when needed, with automatic notifications
- 🎨 **Customizable Appearance**: Match your website's design with customizable chat interface
- 🔒 **Secure Implementation**: Built with WordPress security best practices
- 🚀 **Performance Optimized**: Lightweight implementation with minimal impact on page load times
- 🎯 **Extended Mode**: Configure a larger, more prominent chatbot display for specific pages
- 🎨 **Advanced Styling**: Customize colors, theme, borders, and shadows
- 📱 **Responsive Design**: Works perfectly on all devices and screen sizes
- 📊 **Chat Logs**: Store and view all chatbot conversations in your WordPress admin
- 🔌 **Webhook Integration**: Securely receive chat logs via REST API with HMAC authentication
- 📥 **CSV Export**: Export chat logs with date range filtering for analysis
- 🔍 **Browser ID Filtering**: Filter chat logs by specific browser sessions

**Use Cases:**
- Customer Support Automation
- FAQ and Knowledge Base Access
- Lead Generation and Qualification
- Product Information and Support
- Digital Services as a Bot
- Content Discovery and Navigation
- 24/7 User Assistance

== External services ==

This plugin connects to the HybridAI API to enable chatbot functionalities. It loads an external script from `https://hybridai.one/hai_embed.js`, which is necessary to display the chatbot.

**Data sent to HybridAI:**
- The chatbot ID set in the plugin settings
- The IP Address of the User that interacts with the ChatBot 
- Messages typed by users in the chatbot interface
- Website content (when using the website crawling feature)
- PDF content (when using the PDF upload feature)

HybridAI's services are provided by **HybridAI.one**.  
For more details, please refer to their [Terms of Service](https://hybridai.one/terms) and [Privacy Policy](https://hybridai.one/privacy).

== Installation ==

1a. Download the plugin ZIP file and upload it via **WordPress Admin → Plugins → Add New → Upload Plugin**
1b. Search the Plugin via the Plugin-Store inside your WordPress Installation and install & activate it
2. Activate the plugin via **WordPress Admin → Plugins**
3. Go to **Settings → HybridAI Chatbot** and configure your settings:
   - Enter your **HybridAI Chatbot ID**
   - Customize the appearance settings
   - Configure extended mode if desired
4. Save the settings, and the chatbot will appear on all pages

**Note:** The plugin will work immediately with a default chatbot, but for full functionality, we recommend setting up your own chatbot on HybridAI.one

== Frequently Asked Questions ==

= Where do I get a Chatbot ID? =
You can create a free HybridAI account and generate a chatbot ID at **[HybridAI.one](https://hybridai.one)**. The platform offers both free and premium plans to suit your needs.

= Can I customize the chatbot's appearance? =
Yes, you can customize various aspects of the chatbot's appearance through the plugin settings:
- Color scheme
- Theme (light/dark)
- Border radius
- Box shadow
- Welcome message
- And more!

= What is Extended Mode? =
Extended Mode allows you to configure a larger, more prominent chatbot display for specific pages. You can:
- Set a specific page URL where extended mode should be active
- Configure the chatbot's position, size, and margins
- Enable auto-open functionality
- Adjust opacity and other visual settings

= How does the webhook integration work? =
The plugin provides a secure REST API endpoint to receive chat logs. To use it:
1. Set up a shared secret in the plugin settings
2. Configure your chatbot service to send POST requests to `/wp-json/hybridai/v1/log-message`
3. Include the required headers and HMAC signature
4. All chat logs will be stored in your WordPress database
5. View the logs in the "HybridAI Logs" admin page

= How can I view the chat logs? =
All chat logs are stored in your WordPress database and can be viewed through:
1. The "HybridAI Logs" menu item in your WordPress admin
2. The logs include user messages, bot replies, timestamps, and more
3. Logs are paginated for easy navigation
4. You can see which chatbot and browser session each log belongs to

= Does this plugin store user data? =
Yes, this plugin can store chat logs if you enable the webhook integration. The data stored includes:
- Chatbot ID
- Browser session ID
- Timestamp
- User messages
- Bot replies
All data is stored securely in your WordPress database and can be managed through the admin interface.

= Can I use my own AI model? =
Yes, HybridAI supports multiple LLM providers. You can configure your preferred AI model through the HybridAI dashboard.

= How does the human takeover feature work? =
The human takeover feature allows your support team to seamlessly take over conversations when needed. You'll receive notifications when a conversation requires human intervention, and you can respond directly through the HybridAI dashboard.

= Is the chatbot mobile-friendly? =
Yes, the chatbot is fully responsive and works perfectly on all devices, including mobile phones and tablets.

== Screenshots ==

1. **Chatbot Settings Page** – Configure your chatbot ID and appearance settings
2. **Chat-Bot in WordPress** – How the Chat gets displayed in WP
3. **Chat-Logs** – See how customers interact with the Chat-Logs
4. **Chatbot Backend Settings** – Configure more options via Backend 
5. **Human Takeover** - Chat with your Users as a human instead of the AI if needed

== Changelog ==
= 1.3.5 =
- Fixed: CSV export for chat logs now works as expected (properly hooked into WordPress)

= 1.3.4 =
- 🧠 **NEW: AI Context Intelligence** - Page-aware chatbot responses
- Added automatic page context detection (title and content) for better AI responses
- Context information sent to LLM for server-side computed welcome messages
- Completely restructured admin menu with dedicated pages for better organization
- Created separate "General", "Settings", and "Chat Logs" pages under main HybridAI Chatbot menu
- Enhanced one-click configuration with stunning visual appeal and prominent positioning
- Added success banner for already configured chatbots with quick access to settings
- Improved overall user experience with better visual hierarchy and engagement

= 1.33 =
- Enhanced settings page UI with visual consistency improvements
- Added HybridAI logo to the settings page header
- Moved "How the Chatbot Works" explanation to the top of the settings page
- Integrated shared secret field into the webhook configuration box
- Added visual boxes around Appearance, Extended Mode, and Consent settings sections
- Improved overall layout and user experience of the admin interface

= 1.32 =
- Added an "Inline Mode Settings" section to the settings page, explaining how to use and customize the inline chatbot shortcode.
- CMP consent is now respected for the shortcode/inline chatbot as well

= 1.3 =
- Added Consent Mode feature for bot script injection
- Four script injection options: automatic, manual, CMP-based, and custom script
- CMP-based injection supports Cookiebot, Usercentrics, Borlabs, and HybridAI (localStorage)
- Custom script injection option with text area
- Consent and CMP settings added to plugin settings page
- Improved compliance for regions requiring user consent
- Integration of the Bot via Shortcodes possible

= 1.29 =
- Added one-click bot configuration feature
- Implemented automatic bot creation on plugin activation
- Added bot claiming mechanism with email verification
- Integrated with HybridAI backend for bot management
- Added secure bot transfer functionality
- Improved admin interface with bot status display
- Added registration URL management
- Enhanced security with proper data escaping
- Added WordPress nonce verification for admin actions

= 1.28 =
- Added CSV export functionality for chat logs
- Implemented date range filtering for logs
- Enhanced chat logs interface with filtering options
- Improved data export capabilities
- Added Excel-compatible CSV formatting
- Added browser ID filtering for chat logs
- Improved chat logs interface with better filter layout
- Enhanced CSV export to include browser ID filtering
- Updated filter form with organized structure
- Added combined filtering (date range + browser ID)

= 1.27 =
- Added new appearance customization options
- Introduced Extended Mode for specific pages
- Added support for custom welcome messages
- Improved configuration handling
- Enhanced settings page organization

= 1.26 =
- Restored chatbotID as URL parameter for improved compatibility
- Maintained configuration object for additional settings

= 1.25 =
- Removed chatbotID from script URL parameter for improved security
- ChatbotID is now only passed via configuration object

= 1.24 =
- added default chatbot to make the startup easier
- added a hint to the search-api function call

= 1.23 = 
- added prefix to functions and names for compatibility

= 1.22 = 
- made function calls and names more unique
- added stephannoller as Contributor
- added descritpion of the called hybridai service to readme

= 1.2 =
- Added a settings page for easy configuration.
- Improved compatibility with WordPress 6.4.
- Enhanced security and optimized script loading.

= 1.1 =
- Initial release with automatic chatbot integration.

== Upgrade Notice ==

= 1.28 =
This version adds browser ID filtering to the chat logs, making it easier to track specific user conversations. The chat logs interface has been improved with better organization and combined filtering options.

== License ==
This plugin is licensed under **GPL v2 or later**.  
You are free to modify and distribute it under the same license.

== Shortcodes ==

You can embed a content-style HybridAI Chatbot anywhere using the shortcode:

[hybridai_content_chatbot]

**Attributes:**
- `chatbot_id` (optional): Override the chatbot ID (default: plugin setting or demo ID)
- `welcome_message` (optional): Custom welcome message (default: plugin setting or generic)
- `height` (optional): Height of the chat widget (default: 400px)
- `server` (optional): Chatbot server URL (default: https://hybridai.one)
- `color_scheme` (optional): Color scheme for the widget (default: plugin setting)
- `theme` (optional): Theme - light or dark (default: plugin setting)
- `border_radius` (optional): Border radius for the widget (default: plugin setting)
- `box_shadow` (optional): Box shadow for the widget (default: plugin setting)

**Example:**

[hybridai_content_chatbot chatbot_id="63ad031e-5e6a-4ea6-8f93-cc6994558d8b" welcome_message="Welcome!" height="500px" theme="dark"]

This will output the embeddable content chat widget as described in the documentation.

**Note:**
If CMP mode is active and the user has not yet given consent, a hint will be shown in place of the chatbot until consent is provided.
