=== Mosend Notifications ===
Contributors: moshipp
Tags: whatsapp, woocommerce, notifications, order, digital delivery
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.6.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send WhatsApp and email order notifications to your customers through Mosend (order, payment, shipping, delivery, abandoned cart, digital delivery).

== Description ==
Connect your WooCommerce store to Mosend and send automatic WhatsApp notifications (order received, payment, shipping, delivery, cancellation, refund, abandoned cart and customer notes). Templates and messages are configured from the Mosend panel. The plugin only forwards WooCommerce events, signed with HMAC.

It also adds a "Digital delivery" box on each order to send a product, license/key and instructions to the customer by WhatsApp and/or email — ideal for delivering licenses and access to digital products.

This plugin **requires a Mosend account** (an external, paid service) to work: Mosend is what sends the WhatsApp messages through the official WhatsApp Business API. Without a connection configured in Mosend, the plugin does nothing.

== External services ==

This plugin connects to the Mosend API (https://mosend.co), a WhatsApp Business Platform technology provider, to send WhatsApp notifications to your customers. It is required for the plugin to work.

**When data is sent:** every time a configured event happens in your store (an order is created, a payment is confirmed, the shipping/delivery status changes, a customer note is added, or a cart is abandoned), and when you press "Test connection" in the settings.

**What data is sent** to `https://api.mosend.dev/integrations/ecommerce/{connectionId}/events`:

* Order data: number, status, total, currency, products (name and quantity), payment/order-status links.
* Customer contact data: name, phone and email address (needed to deliver the WhatsApp message).
* Your store name and URL.
* For abandoned cart: only if the customer gave explicit consent at checkout.

Each request is signed with HMAC-SHA256 using your secret. The plugin does not store this data: it forwards it to Mosend, which is responsible for processing it and sending the message.

Use of this service is subject to Mosend's Terms and Privacy Policy:

* Terms of service: https://mosend.co/terminos
* Privacy policy: https://mosend.co/privacidad


**Orders from WhatsApp (off by default):** if you turn on "Let the assistant create orders in the store", Mosend calls your store at `/wp-json/mosend/v1/pedido`, signed with your connection secret, sending the product IDs, quantities and the customer's name, phone and email. Your store creates a pending order and answers with its number, total and payment link.

**Wompi payments (off by default):** if you paste Mosend's Wompi events URL in "Wompi payments", the plugin forwards to that URL a copy of the Wompi events your store receives whose payment reference was created by Mosend (references starting with `lic_`). The event is sent as Wompi signed it (reference, amount, status and transaction ID). Your store's own payments are never forwarded, and your store keeps processing every event as before.

**Updates:** twice a day WordPress reads `https://mosend.co/descargas/mosend-woocommerce.json` to know if there is a new version of the plugin; if so, it downloads it from `https://mosend.dev/descargas/`. Only the request itself is sent (no store or customer data).

== Installation ==
1. Install and activate the plugin (requires WooCommerce).
2. Create a free account at https://app.mosend.dev/signup and, in Mosend → Integrations → Stores, create a connection.
3. In WooCommerce → Mosend, paste the URL, connection ID and secret, and press "Test connection".

== Frequently Asked Questions ==

= Do I need a Mosend account? =
Yes. The plugin only forwards your store events; the WhatsApp messages are sent by Mosend through the official WhatsApp Business API. You can sign up for free at https://mosend.co.

= Does the plugin slow down my customers' checkout? =
No. Events are queued (with Action Scheduler, included in WooCommerce) and sent in the background with automatic retries. Checkout never waits for the network.

= What data is sent to Mosend? =
Order data and the customer contact data needed to deliver the message (name, phone, email, products). See the "External services" section above for the full detail.

= Does it work with the block checkout (Gutenberg)? =
Order events (received, payment, shipping, delivery, note) work on both the classic and block checkout. The consent checkbox and abandoned-cart capture currently work only on the classic checkout.

= Is it compatible with HPOS (High-Performance Order Storage)? =
Yes. The plugin uses the WooCommerce API exclusively and declares HPOS compatibility.

== Changelog ==

= 1.6.0 =
* Order lookup for the WhatsApp assistant: Mosend can ask the store for the status of an order by its number (signed request, read-only). It returns the status, products with their price, total and whether it was delivered; never the license or the billing details.

= 1.5.0 =
* Wompi payments: a Wompi account allows only one events URL. If yours points to this store, the plugin can forward to Mosend a copy of the payments Mosend charged with that same account (card and Nequi payments sold by the WhatsApp assistant). Your store keeps processing every event as before, and its own payments are never forwarded. Off until you paste Mosend's URL in "Wompi payments".

= 1.4.0 =
* Orders from WhatsApp: the Mosend assistant can create the order in your store and send the customer the payment link. WooCommerce calculates prices and taxes; the assistant only picks product and quantity. Off by default ("Let the assistant create orders in the store").
* Catalog sync sends the whole catalog in one request (up to 1,000 products). Before, stores with more than 200 products could end up with part of the catalog turned off in Mosend.

= 1.3.0 =
* Redesigned settings page (WooCommerce → Mosend): a status band at the top says whether the store is connected, when the last notification went out, or what is missing to connect it; settings are grouped in sections with the Mosend look.
* "Test connection" now explains what failed (unknown connection ID, wrong secret) instead of showing the raw server response.

= 1.2.1 =
* Updates from Mosend: new versions now appear in Plugins with the "Update now" button (and can be updated automatically), instead of uploading the ZIP by hand.

= 1.0.13 =
* Digital delivery: the WhatsApp instructions field now accepts a short text (such as an activation token or a one-line step), not only a link. The email shows it as a highlighted line next to the license when it is text, or as a button when it is a link.

= 1.0.12 =
* Compliance and i18n fixes for the WordPress.org Plugin Directory.

= 1.0.9 =
* Digital delivery: full-width box under the order, with an optional expiration date and detailed text instructions — both included in the email (WhatsApp keeps sending the link).
* Email: smaller product name, license as the highlight, expiration badge and an instructions block that keeps line breaks.

= 1.0.8 =
* Digital delivery: per-order send history (who, when and which channel) — also stored as an order note so any agent can see if it was already sent.
* Redesigned delivery email: now uses the WooCommerce email template (header, logo, colors and sender of your store) for a more professional, consistent look.

= 1.0.7 =
* Digital delivery: new box inside each order with product, license/key and an instructions link, plus a "Send delivery" button via WhatsApp and/or email (the latter from your own WordPress). Built to deliver licenses and access to digital products with clean formatting.

= 1.0.6 =
* Customer notes (digital delivery) keep their line breaks.

= 1.0.5 =
* Reliable sending: events are queued with Action Scheduler and retried automatically (up to 5 times, with progressive backoff) if Mosend or the network fail.
* New "Recent sends" panel in the settings: the status of each event without opening server logs.
* HPOS (High-Performance Order Storage) compatibility declared.
* Cleanup on uninstall (uninstall.php).

= 1.0.4 =
* Template personalization (store name, order-status link, customer note for digital deliveries) and a global communication switch.
