=== BlueSales ===
Contributors: bluesales
Tags: leads, voice, woocommerce, calls, ai
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 2.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Call your leads the second they arrive. Build and run BlueSales AI voice agents from inside WordPress.

== Description ==

BlueSales gives your site a dedicated dashboard for AI voice agents — Blues — and calls a new lead within seconds of them filling in a form. No CSV exports, no copying phone numbers, no switching tabs.

**What it does**

* Calls a new lead immediately, using the Blue you picked for that specific form.
* Creates Blues without leaving WordPress: name, role, business, voice, knowledge and personality in one short wizard, with voice samples you can listen to before choosing.
* Routes each form to its own Blue and its own lead list — a quote request and a support enquiry do not have to be handled by the same agent.
* Captures WooCommerce orders at whichever order status you choose.
* Shows the account's call log, leads, business profiles, brains, products, phone numbers, voices and compliance flags.
* Records every lead it sends, skips or fails to send, with the reason.

**Supported form plugins**

* Contact Form 7
* WPForms
* Gravity Forms

Your forms are detected automatically and listed on the Triggers screen. Using something else? Fire the action from your own code:

`do_action( 'bluesales_capture_lead', array( 'name' => 'Ada Lovelace', 'phone' => '020 7946 0958' ), 'my-form' );`

**Calling people responsibly**

Placing an automated call to someone who did not agree to it can breach telemarketing law where you or they live — the TCPA in the United States, PECR and UK GDPR in the United Kingdom, and equivalents elsewhere. The liability sits with the site placing the call. The plugin can refuse to send any lead unless a named consent field was ticked; turn it on in Settings, and keep your own record of what people agreed to.

**Third-party service**

This plugin sends data to the BlueSales API, a third-party service operated by BlueSales, and does not function without an account there. Data is sent only after you enter an API key and switch on a trigger.

* What is sent: the name, phone number, email address, company and postal address found in a submission or order, plus the Blue and lead list you select. Creating a Blue also sends what you type into the wizard.
* When it is sent: on form submission, on the WooCommerce order event you configure, or when you use the admin screens.
* Service: https://bluesales.ai/
* Terms of service: https://bluesales.ai/terms-of-service
* Privacy policy: https://bluesales.ai/privacy-policy

**Bundled fonts**

Inter and Poppins are bundled under the SIL Open Font License 1.1 and served from this site. Nothing is loaded from a CDN, so no administrator's IP address is sent to a third party on an admin page load.

== Installation ==

1. Upload the `bluesales` folder to `/wp-content/plugins/`, or install through the Plugins screen.
2. Activate the plugin.
3. In your BlueSales dashboard open **API** and create a key with the `lead_lists:read`, `leads:write`, `blues:read`, `blues:write` and `calls:write` permissions.
4. In WordPress open **BlueSales**, paste the key and press **Test connection**.
5. On **Settings**, pick a default Blue and lead list, and set your country calling code.
6. On **Triggers**, switch on the forms you want and choose which Blue answers each one.

== Frequently Asked Questions ==

= Do I need a BlueSales account? =

Yes. The plugin is a client for the BlueSales API and does nothing on its own.

= Can I create a Blue from WordPress? =

Yes. **BlueSales → Blues → Create a Blue** walks through it in five steps and creates the business profile in the same request, so a failure never leaves a half-built agent behind. Voices are listed with gender, accent and engine, and you can play a sample before choosing.

= Can two forms use two different Blues? =

Yes — that is the point of the Triggers screen. Every form found on your site gets its own row, with its own Blue and lead list. Anything left as "Default" follows the Settings screen, so you can move every form at once by changing one dropdown.

= Why was my lead skipped? =

The dashboard's activity log gives the reason for each one — usually no usable phone number, a missing consent field, or the same number inside the duplicate window.

= How are form fields matched? =

By name. A field called `phone`, `Phone number`, `mobile` or `tel` becomes the phone number; `email`, `first name`, `company` and `city` are matched the same way. A single `Name` field is split into first and last. Unrecognised fields are ignored rather than guessed at.

= Someone typed a local number. What happens? =

It is combined with the default country code from Settings. Numbers already starting with `+` or `00` are left alone. Anything that cannot be turned into a valid international number is skipped and logged.

= Will a slow API response slow down my checkout? =

No. Leads are queued and sent on a background cron event, so the visitor's request finishes immediately. If cron is unavailable the lead is sent inline rather than dropped.

= Can the same person be called twice? =

Not within the duplicate window, which defaults to 60 minutes. Set it to 0 while testing.

= Does it work with High-Performance Order Storage? =

Yes. Orders are read through the WooCommerce CRUD API and HPOS compatibility is declared.

== Screenshots ==

1. The dashboard: leads sent, calls placed, and what still needs setting up.
2. Triggers: every form on the site, each with its own Blue.
3. The create-a-Blue wizard, with the voice picker.
4. The call log, filtered by Blue and date range.

== Changelog ==

= 2.0.0 =
* New top-level BlueSales menu with its own branded interface, replacing the single screen under Settings.
* Create Blues from WordPress with a five-step wizard, including a voice picker with samples.
* Per-form routing: each form chooses its own Blue and lead list.
* New screens for the call log, leads, and account resources.
* Place a test call to a number you control before going live.
* Inter and Poppins bundled locally; no CDN requests.

= 1.0.0 =
* Initial release.
* Contact Form 7, WPForms and Gravity Forms lead capture.
* WooCommerce order capture with a configurable trigger status.
* Consent requirement, duplicate-number window and activity log.

== Upgrade Notice ==

= 2.0.0 =
The settings screen has moved from Settings > BlueSales to its own top-level BlueSales menu. Per-form triggers replace the old global on/off switches, so open Triggers after upgrading and switch on the forms you want.
