=== RootLabs Sync for Listmonk ===
Contributors: blacknovamx
Tags: listmonk, woocommerce, email marketing, newsletter, subscribers
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WooCommerce with your self-hosted Listmonk instance and sync opted-in customers to your mailing lists.

== Description ==

RootLabs Sync for Listmonk connects your WooCommerce store with Listmonk, the open source, self-hosted newsletter and email marketing platform.

The plugin helps store owners build an email list from WooCommerce customers while keeping control of their own marketing infrastructure. Customers can opt in during checkout, and approved subscribers are sent to the Listmonk list selected by the store administrator.

The free version focuses on the essential workflow: connect WordPress to Listmonk, show an opt-in checkbox at checkout, sync customers when orders are processed or completed, run a manual bulk sync for existing customers, and review sync logs from the WordPress admin.

= Key Features =

* Sync WooCommerce customers to a user-configured Listmonk instance.
* Checkout opt-in checkbox, disabled by default.
* Compatible with classic WooCommerce checkout.
* Compatible with WooCommerce block-based checkout.
* Sync customers when orders move to processing or completed status.
* Manual bulk sync for existing WooCommerce customers.
* Connection test from the plugin settings screen.
* Select a default Listmonk mailing list.
* Sync logs with status, email, action, message, and date.
* Automatic log cleanup after 30 days.
* API token storage encrypted with WordPress salts.
* WooCommerce HPOS compatible.

= Built for Self-Hosted Email Marketing =

Listmonk is a free and open source newsletter and mailing list manager that runs on your own server. It provides subscriber management, mailing lists, campaigns, templates, analytics, and API access.

RootLabs Sync for Listmonk does not create a Listmonk server for you. You need an existing Listmonk installation with API access enabled.

= Typical Use Cases =

* Add a newsletter opt-in checkbox to your WooCommerce checkout.
* Send consenting customers from WooCommerce to Listmonk.
* Keep your email marketing data on your own infrastructure.
* Migrate store marketing workflows away from hosted email platforms.
* Run a one-time bulk sync for existing WooCommerce customers.
* Audit sync results through local WordPress logs.

= RootLabs Sync for Listmonk Pro =

Need more advanced automation? RootLabs Sync for Listmonk Pro adds features designed for stores that need deeper segmentation and scheduled synchronization.

Pro features may include:

* Scheduled automatic sync.
* Product/category-based list segmentation.
* Customer attributes such as total spent, last product, city, or order metadata.
* Webhook support for syncing unsubscribe events from Listmonk back to WooCommerce.
* Priority support.

Learn more at:
https://rootlabs.mx/product/listmonk-sync/

== External Services ==

This plugin connects to a Listmonk instance configured by the site administrator.

Listmonk is a self-hosted email marketing and newsletter platform. The plugin sends subscriber data from WooCommerce to the Listmonk API only after the administrator configures the Listmonk URL and API credentials in the plugin settings.

Service name: Listmonk
Service website: https://listmonk.app/
API documentation: https://listmonk.app/docs/apis/apis/
Terms and privacy policy: Determined by the user's own Listmonk instance and hosting environment.

= When Data Is Sent =

Data may be sent to the configured Listmonk instance in the following cases:

* When a WooCommerce order is set to processing and the customer opted in.
* When a WooCommerce order is completed and the customer opted in.
* When a site administrator runs a manual bulk sync from the plugin settings.

= What Data Is Sent =

The plugin may send the following subscriber data to the configured Listmonk instance:

* Customer email address.
* Customer first name and last name from WooCommerce billing details.
* Subscription status.
* Target Listmonk list ID selected by the administrator.

= Authentication =

The plugin authenticates with Listmonk using HTTP Basic Authentication with an API username and API token created in the Listmonk admin panel.

The API token is stored in the WordPress database encrypted with AES-256-CBC using WordPress authentication salts. The token is decrypted only when the plugin needs to make an API request.

= Local Data Storage =

The plugin stores sync logs in the WordPress database for troubleshooting and audit purposes. Logs may include action, status, email address, message, and date.

Sync logs are automatically cleaned after 30 days.

Site administrators are responsible for configuring their Listmonk instance and ensuring that their use of this plugin complies with applicable privacy, consent, and email marketing laws.

== Requirements ==

* WordPress 6.4 or higher.
* PHP 8.1 or higher.
* WooCommerce installed and active.
* A working Listmonk instance.
* A Listmonk API user and API token.
* The PHP OpenSSL extension enabled.

== Installation ==

1. Upload the `rootlabs-sync-for-listmonk` folder to `/wp-content/plugins/`, or install the plugin from the WordPress Plugin Directory.
2. Activate the plugin from the WordPress admin.
3. Go to the Listmonk Sync settings screen.
4. Enter your Listmonk URL.
5. Enter your Listmonk API username and API token.
6. Click "Test Connection" to verify access and load available lists.
7. Select the default Listmonk list.
8. Enable the checkout opt-in checkbox if you want to collect consent during checkout.
9. Save the settings.

== How to Create a Listmonk API Token ==

1. Log in to your Listmonk admin panel.
2. Go to the Users section.
3. Create or edit an API user.
4. Generate an API token.
5. Copy the token immediately, because Listmonk may only show it once.
6. Paste the API username and token into the plugin settings screen in WordPress.
7. Test the connection before enabling live sync.

== Frequently Asked Questions ==

= Do I need Listmonk to use this plugin? =

Yes. This plugin connects WooCommerce to a Listmonk instance. It does not host Listmonk for you.

= Is Listmonk free? =

Listmonk is free and open source software. You can host it yourself or use your own managed hosting environment.

= Does this plugin send data to RootLabs? =

No. The plugin sends subscriber data only from your WordPress site to the Listmonk instance configured by the site administrator.

= Is the checkout opt-in checkbox checked by default? =

No. The opt-in checkbox is unchecked by default so customers can provide explicit consent.

= Does it work with WooCommerce Checkout Blocks? =

Yes. The plugin includes support for both classic WooCommerce checkout and block-based checkout.

= Does it support WooCommerce HPOS? =

Yes. RootLabs Sync for Listmonk is designed to work with WooCommerce High-Performance Order Storage.

= What happens if Listmonk is unavailable? =

The plugin records the sync result in the local sync logs. Store administrators can review failed sync attempts from the plugin settings screen.

= Can I sync existing WooCommerce customers? =

Yes. The plugin includes a manual bulk sync tool for existing WooCommerce customers.

= Can I choose different lists for different products or categories? =

The free version syncs to one default Listmonk list. Advanced segmentation may be available in the Pro version.

= Is the API token stored securely? =

The API token is encrypted before being stored in the WordPress database, using WordPress authentication salts and AES-256-CBC encryption.

= Can I delete plugin data? =

When the plugin is uninstalled, plugin options and local plugin tables may be removed according to the plugin uninstall routine.

== Screenshots ==

1. Listmonk connection settings.
2. Checkout opt-in configuration.
3. Manual bulk sync screen.
4. Sync logs table.

== Changelog ==

= 1.0.0 =
* Initial public release.
* WooCommerce customer sync to Listmonk.
* Checkout opt-in support.
* Classic checkout support.
* Checkout Blocks support.
* Manual bulk sync.
* Connection test.
* Sync logs.
* Encrypted API token storage.
* HPOS compatibility.

== Upgrade Notice ==

= 1.0.0 =
Initial public release.
