=== The Bot Forge Chatbot ===
Contributors: thebotforge
Tags: chatbot, AI, customer service, sales, automation
Requires at least: 5.8
Tested up to: 7.1
Stable tag: 2.0.0
Requires PHP: 7.2
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed The Bot Forge chatbot into your WordPress website to enhance customer service, sales assistance, and more with AI-powered interactions.

== Description ==

Welcome to The Bot Forge, a cutting-edge platform where you can create your own AI-powered chatbots trained on your proprietary data! Whether you need a chatbot for customer service, sales assistance, or any other function, The Bot Forge makes it simple and effective.

### What the plugin does

* **Two-minute setup**: Paste your Bot ID (or the whole embed snippet, the plugin finds the ID) and save.
* **Live connection check**: See right away whether your bot exists and is allowed on your domain, with a clear fix when it isn't.
* **Live preview**: See your bot's real chat bubble and welcome message, and chat with it on the settings screen.
* **Display rules**: Show the chatbot everywhere, only on pages you pick, or everywhere except pages you pick. Limit it to desktop or mobile, and hide it from logged-in users.
* **Per-page control**: Hide the chatbot on any page or post from the Chatbot panel in the editor (block editor and classic editor).
* **Works with speed plugins**: Tells WP Rocket, LiteSpeed Cache, SiteGround Speed Optimizer, Autoptimize, Jetpack Boost and Cloudflare Rocket Loader to leave the chat widget alone, and shows step-by-step exclusion instructions for other caching plugins it finds.

### The Bot Forge platform

The plugin connects your site to a bot you create at [app.thebotforge.ai](https://app.thebotforge.ai). On that platform you can:

* **Custom Chatbot Creation**: Train and customize chatbots with diverse data sources like documents, videos, and web links.
* **Website Integration**: Effortlessly embed chatbots into your site as customer service reps, sales assistants, and more.
* **Customization and Branding**: Tailor chatbot appearance and features to align with your branding strategy.
* **AI-Driven Contact Form**: Convert standard forms into dynamic interfaces for surveys, lead gen, and customer support.
* **Subscription Plans and Add-Ons**: Choose from tiered subscriptions with scalable features tailored to your needs. Freemium plan available.

### Benefits to Users

* Boost customer engagement with 24/7 automated service.
* Enhance lead generation and qualification through intelligent chatbot interactions.
* Streamline internal operations with dedicated HR and internal assistance bots.
* Increase sales and conversion rates with on-demand product recommendations and support.
* Ensure brand consistency across all customer interactions with fully customizable designs.

### Third-Party Services

This plugin relies on the following third-party service:

- **Service Name**: The Bot Forge
- **Service URL**: [https://app.thebotforge.ai](https://app.thebotforge.ai)
- **Terms of Use**: [https://thebotforge.ai/terms](https://thebotforge.ai/terms)
- **Privacy Policy**: [https://thebotforge.ai/privacy-policy](https://thebotforge.ai/privacy-policy)

What is sent, and when:

* **On your public pages**: When a Bot ID is saved, visitors' browsers load the chat widget from `https://app.thebotforge.ai/chatWidget.js`. The widget sends the Bot ID and your site's domain to The Bot Forge to load your bot, and sends the messages visitors type so the bot can answer.
* **On the plugin's settings screen**: The connection check sends your Bot ID and your site's domain from your server to `https://app.thebotforge.ai/api/chatwidget`. It runs when you open the settings screen, when you enter a Bot ID, and when you click "Check connection". A successful check is remembered for 10 minutes. "Bot not found" and "domain blocked" are remembered for 2 minutes, and a busy or unreachable result for 1 minute. Each site makes at most 20 real checks in any 10-minute period. These checks are marked as admin previews and are not counted as widget impressions.
* **Live preview**: When your bot is connected, the settings screen loads the chat widget so you can test it. You can turn this off with the "Live widget on this screen" switch.

Nothing is sent until you enter a Bot ID.

== Installation ==

1. Upload `the-bot-forge-chatbot` to the `/wp-content/plugins/` directory, or install it from the Plugins screen.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Open 'Bot Forge Chatbot' in the WordPress admin menu.
4. Paste your Bot ID. The plugin checks the connection straight away.
5. Click 'Save changes'. Your chatbot is now live.

== Frequently Asked Questions ==

= How do I get a Bot Forge Chatbot ID? =

Visit [app.thebotforge.ai](https://app.thebotforge.ai) and sign up for a free account. Create your chatbot using our intuitive platform. Once your chatbot is ready, copy the Bot ID from Share / Embed → WordPress. You can paste the whole embed snippet or chat link; the plugin keeps only the ID.

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

Yes. Under "Where it appears", choose "Only on pages I pick" or "Every page except…", then search for pages and posts by title. The homepage can be picked even if it shows your latest posts. You can also limit the chatbot to desktop or mobile, and hide it for logged-in users.

= Can I hide the chatbot on a single page? =

Yes. Open the page or post in the editor and turn on "Hide chatbot on this page" in the Chatbot panel of the sidebar. This works in both the block editor and the classic editor, and it overrides your site-wide display rules for that page.

= The connection check says my domain is blocked. What do I do? =

Domain security is turned on for your bot and your site isn't on its allowed list. In The Bot Forge, open your bot, go to Advanced → Domain Security and add your domain. The settings screen links straight there.

= The chatbot doesn't show up on my site. =

Check these in order:

1. The header on the plugin's settings screen says "Live". If it doesn't, follow the message under "Check connection".
2. Your display rules include the page you're looking at, and "Hide for logged-in users" is off if you're testing while logged in.
3. If you use a caching or speed plugin, clear its cache. The "Speed and caching plugins" card on the settings screen lists the ones it found and how to exclude the chat widget.

Administrators can view the page source and look for the "The Bot Forge Chatbot" comment near the end, which explains why the chatbot was or wasn't added.

= Does it work with caching plugins? =

Yes. Display rules are decided before the page is cached, and the desktop/mobile rule runs in the visitor's browser, so cached pages behave correctly. The plugin automatically excludes the chat widget from JavaScript minification, combining and delaying in WP Rocket, LiteSpeed Cache, SiteGround Speed Optimizer, Autoptimize, Jetpack Boost and Cloudflare Rocket Loader. For W3 Total Cache, WP Fastest Cache, Perfmatters, FlyingPress, Hummingbird, NitroPack, WP-Optimize and Breeze, the settings screen shows the exclusion steps.

= I upgraded from 1.x. Do I need to redo my page list? =

No, when the old entries still match a page. Page IDs, paths such as `about/team`, slugs, and exact page titles are converted to the new page picker. An entry that matches nothing is listed on the settings screen until you pick those pages and save, or dismiss the note. Saving other settings does not clear that note. A site that showed the chatbot on every page stays that way.

= For developers: are there hooks? =

* `bot_forge_chatbot_should_display` (filter, bool): final say on whether the widget loads on the current request.
* `bot_forge_chatbot_script_attributes` (filter, array): attributes added to the widget's script tag.
* `bot_forge_chatbot_exclude_from_optimizers` (filter, bool): return false to stop the automatic speed-plugin exclusions.

Define `BOT_FORGE_CHATBOT_DEBUG` as true (with `WP_DEBUG` on) to log every display decision to the debug log.

= What are the system requirements? =

Your site must be running WordPress 5.8 or higher and PHP 7.2 or higher.

== Changelog ==

= 2.0.0 =
* New: Redesigned settings screen with a live connection status, guided setup and a save bar that appears when you change something.
* New: Connection check that tells you whether your bot exists and is allowed on your domain, with a direct link to fix domain security.
* New: Live preview of your bot's chat bubble and welcome message, plus the real widget on the settings screen for testing (not counted as impressions).
* New: Display rules. Show on every page, only on picked pages, or every page except picked pages, with a searchable page picker that includes the homepage.
* New: Show on desktop only or mobile only, and hide for logged-in users. Works with page caching.
* New: "Hide chatbot on this page" in the block editor sidebar and the classic editor.
* New: Detects speed and caching plugins. Automatic widget exclusions for WP Rocket, LiteSpeed Cache, SiteGround Speed Optimizer, Autoptimize, Jetpack Boost and Cloudflare Rocket Loader, and instructions for others.
* New: Shortcuts to edit your bot, your inbox and analytics in The Bot Forge. "Open The Bot Forge" goes straight to your bot's settings once its ID is saved and connected.
* Improved: Paste a chat link or embed snippet and the plugin extracts the Bot ID. Invalid IDs are rejected with a clear message instead of being saved.
* Improved: The widget now loads in the footer with the standard WordPress script loader.
* Improved: Old page lists (IDs, paths, slugs and exact titles) are migrated to the new page picker. Unmatched entries stay listed until you update the page list or dismiss the note.
* Fixed: The settings stylesheet now loads reliably.
* Fixed: The settings script no longer runs on other admin screens.
* Fixed: Other plugins' admin notices are no longer hidden on the settings screen.
* Added uninstall cleanup of all plugin data.
* Requires WordPress 5.8 or higher.
* Tested with WordPress 7.1.

= 1.6.4 =
* Fixed chat widget failing when optimization plugins (e.g. WP Rocket) host chatWidget.js on the site's own domain.

= 1.6.3 =
* Tested and confirmed compatible with WordPress 7.0.

= 1.6.2 =
* Added settings link to plugins page

= 1.6.1 =
* Updated Admin Page Styles

= 1.6 =
* Updated Stylesheet Code

= 1.5.2 =
* Updated Readme

= 1.5.1 =
* Added logo to settings page

= 1.5 =
* Updated to ensure compatibility with the latest WordPress version 6.5.
* Improved compliance with WordPress plugin guidelines.
* Added documentation for third-party services used by the plugin.

= 1.3 =
* Initial release of The Bot Forge Chatbot plugin.

== Upgrade Notice ==

= 2.0.0 =
Major update: redesigned settings screen, connection check, live preview, display rules by page and device, per-page hiding and caching-plugin support. Your Bot ID and page list carry over automatically.

= 1.6.4 =
* Recommended update if your chat widget fails to load with optimization/caching plugins enabled.

= 1.6.3 =
* Update optional for WordPress 7.0 compatibility confirmation.

= 1.6.2 =
* Update Optional

= 1.6.1 =
* Update Optional

= 1.6 =
* Update required for stylesheet MIME type

= 1.5.2 =
* Update optional for logo and readme additions.

= 1.5 =
* Update required for compatibility and compliance improvements.

= 1.3 =
* Initial release of The Bot Forge Chatbot plugin.

== Credits ==

The settings screen uses the Lexend typeface by Bonnie Shaver-Troup and Thomas Jockin, licensed under the SIL Open Font License 1.1 (see `admin/fonts/OFL.txt`).

== License ==

This plugin is licensed under the GPL-2.0-or-later. For more information, see https://www.gnu.org/licenses/gpl-2.0.html.
