=== WatZap.id ===
Contributors: watzapid, watzapindonesia
Donate link: https://watzap.id/
Tags: whatsapp, woocommerce, notification, contact form, elementor
Requires at least: 6.8
Tested up to: 7.1
Stable tag: 1.1.2
Requires PHP: 7.2
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Send WhatsApp notifications from WooCommerce, Sejoli, Elementor, WPForms, Contact Form 7 and any custom form through your WatZap account.

== Description ==

WatZap is the official WordPress plugin for [WatZap.id](https://watzap.id/), a WhatsApp messaging service for businesses. Connect the plugin with your WatZap API key and your site can send WhatsApp messages to buyers, members, and your own team from the events that already happen on your site.

**What you can do**

* **WooCommerce** – send a WhatsApp message to the buyer and to the seller on every order status (pending, processing, completed, cancelled, refunded, and so on), with optional follow-up messages. Abandoned carts from the CartBounty plugin can be followed up as well.
* **Sejoli** – buyer, member, and seller notifications for every Sejoli order status, plus bulk sending.
* **Form integrations** – catch submissions from Elementor Forms, WPForms, Contact Form 7, Kirim.Email, or any custom HTML form found by the built-in form scanner, then notify the visitor and your team on WhatsApp.
* **WatZap Form widget** – an Elementor widget that renders a WhatsApp lead form with a country-code picker and optional Google reCAPTCHA v3.
* **Two sending channels** – a regular WhatsApp number connected to WatZap, or a WhatsApp Business API (Official/WABA) template. Template parameters are mapped from form fields or order data, including dynamic URL-button values.
* **Number management** – rotate several sending numbers, see their status, and manage approved WABA templates from the dashboard.
* **Checkout helpers** – show a country-code picker on the WooCommerce or Sejoli checkout form and, optionally, ask for the buyer's consent before sending WhatsApp messages.

**Requirements**

You need a WatZap account and an API key from [watzap.id](https://watzap.id/). The plugin does nothing until a valid key is saved.

**Third-party services**

This plugin relies on the following external services. Data is only sent when the related feature is used.

* **WatZap API** (`https://api.watzap.id/` and `https://app.watzap.id/`) – the messaging service this plugin exists for. Every WhatsApp message, sending-number check, and WABA template lookup is sent to WatZap servers together with your WatZap API key, the recipient's phone number, the message text or template parameters, and your site's host name. The API key is also verified periodically (via WP-Cron / Action Scheduler) so the dashboard can show the status of your numbers. Service provider: WatZap.id – [terms of service](https://watzap.id/syarat-ketentuan), [privacy policy](https://watzap.id/privacy-policy).
* **Google reCAPTCHA** (`https://www.google.com/recaptcha/`) – only when you enable reCAPTCHA v3 on the WatZap Form widget. The reCAPTCHA script is loaded on pages that contain that widget, and the visitor's token is verified with Google when the form is submitted. Provider: Google – [privacy policy](https://policies.google.com/privacy), [terms of service](https://policies.google.com/terms).

No other server is contacted. The country-code picker uses the default country from your settings; visitor IP addresses are never sent anywhere.

**Source code and build tools**

All PHP, JavaScript and CSS written for this plugin ships unminified inside the plugin. Bundled third-party libraries ship with their unminified source next to the minified build, plus their license files:

* Bootstrap 5.3.8 (`assets/external/bootstrap.*`) – https://github.com/twbs/bootstrap
* Font Awesome Free 7.3.1, CSS and webfonts only (`assets/external/fontawesome/`) – https://github.com/FortAwesome/Font-Awesome
* Select2 4.1.0 (`assets/external/select2/`) – https://github.com/select2/select2
* DataTables 2.3.7 with the Bootstrap 5 integration (`assets/external/dataTables.*`) – https://github.com/DataTables/DataTables
* SweetAlert2 11.26.25 (`assets/external/sweetalert2.all.*`) – https://github.com/sweetalert2/sweetalert2
* Lightbox2 2.12.0 (`assets/external/lightbox2/`) – https://github.com/lokesh/lightbox2
* intl-tel-input 29.2.3 (`assets/vendor/intltel/`) – https://github.com/jackocnr/intl-tel-input
* Action Scheduler 4.1.0 (`vendor/action-scheduler/`) – https://github.com/woocommerce/action-scheduler
* UIkit 3.25.21 (`assets/design-system/uikit.min.js`, `uikit-icons.min.js`) – https://github.com/uikit/uikit. `assets/design-system/uikit-scoped.min.css` is UIkit's own `uikit.min.css` with every selector scoped under `.wzp-app`; it is generated from the upstream file with the included Node script: `node assets/design-system/build-namespace.mjs uikit.min.css .wzp-app > uikit-scoped.min.css`.

The country list in `assets/js/wz-country-data.js` and the flag sprite in `assets/img/wz-flags.png` are generated by `tools/gen-country-data.js` and `tools/gen-flag-sprite.js`.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`, or install the plugin through the WordPress *Plugins* screen.
2. Activate the plugin through the *Plugins* menu in WordPress.
3. Open the **WatZap** menu in your dashboard and paste the API key from your WatZap account.
4. Turn on the integrations you need (WooCommerce, Sejoli, Custom Form) and write the messages for each event.

== Frequently Asked Questions ==

= Do I need a WatZap account? =

Yes. Messages are sent through the WatZap service, so you need an account and an API key from [watzap.id](https://watzap.id/).

= Which forms are supported? =

Elementor Forms, WPForms, Contact Form 7, and Kirim.Email are detected automatically. Any other HTML form can be added with the form scanner: paste the page URL, pick the form, and map its fields.

= What is the difference between the Regular and Official channels? =

The Regular channel sends free-text messages from a WhatsApp number you connected to WatZap. The Official channel sends approved WhatsApp Business API templates; you map each template parameter to a form field or order value.

= Where are the logs? =

Sending logs are written to `wp-content/uploads/watzap-logs/`. The folder is protected from direct web access and the file names contain a random key.

= Does the plugin send data anywhere else? =

Only to the services listed under *Third-party services* above, and only when the related feature is in use.

== Screenshots ==

1. WhatsApp Numbers – connection status of the official sender number and its delivery health.
2. Custom Form – one list for WPForms, Contact Form 7, KIRIM.EMAIL, and plain HTML forms.
3. WooCommerce – switch on a WhatsApp message for every order status, with follow-ups and seller notifications.
4. Sejoli – member, affiliate, and admin notifications for every order status.
5. WABA Templates – browse the approved templates from your WatZap account before using them.

== Changelog ==

= 1.1.2 =
* Changed: every function, class, constant, option, hook and AJAX action now uses the `watzap_` prefix (previously `wzp_` / `wzl_`). Existing `wzp_*` options and the abandoned-cart meta are renamed automatically the first time the new version loads; follow-up reminders already queued under the old hook names still run.
* Security: the API key is no longer sent to the browser on admin pages; the only exception is the ThemeFood settings auto-fill, which now runs solely for administrators on sites where ThemeFood is installed. The channel settings saved together with the WooCommerce, Sejoli and form notification forms now require the admin nonce. Sejoli bulk notifications read the message from the Sejoli hook instead of the raw request.
* Updated: DataTables 3.0.4.
* Removed: unused `wzp_licenses_key_dev` constant and an unused error-summary panel that loaded Google Fonts.
* Fixed: PHP warnings on the WooCommerce and Sejoli notification pages when a notification had never been saved.

= 1.1.1 =
* Changed: every script and style is now registered and enqueued through the WordPress script/style API; no inline `<script>`/`<style>` blocks are printed.
* Changed: the country-code picker no longer looks up the visitor's country through geoplugin.net; it uses the default country from your settings. No visitor data leaves the site.
* Changed: main plugin file renamed to `watzap-id.php`.
* Updated: Bootstrap 5.3.8, Font Awesome 7.3.1, Select2 4.1.0, DataTables 2.3.7, SweetAlert2 11.26.25, Lightbox2 2.12.0, intl-tel-input 29.2.3, Action Scheduler 4.1.0 (requires WordPress 6.8).
* Removed: unused emoji-area library.
* Fixed: admin URLs are built with `admin_url()` so custom `wp-admin` locations work.
* Fixed: reCAPTCHA keys of the WatZap Form widget are stored under prefixed option names (existing values are migrated).

= 1.1.0 =
* New: Official (WhatsApp Business API) channel for WooCommerce, Sejoli, and form notifications, with template parameter mapping and dynamic URL-button values.
* New: Integrations screen with per-event message editor, live template preview, and notification recipients.
* New: WatZap Form widget takes over form submission with redirect and success message settings.
* Improved: Contact Form 7 submissions are captured on both `wpcf7mailsent` and `wpcf7mailfailed`.
* Improved: sending logs moved to `wp-content/uploads/watzap-logs/` with access protection.
* Fixed: duplicate country-code picker and overlapping flag on checkout and widget forms.
* Fixed: 404 after submitting a WatZap Form widget without a redirect URL.
* Security: nonce verification on all dashboard actions, input sanitization and output escaping across the plugin, direct file access protection.
* Under the hood: all HTTP calls use the WordPress HTTP API, assets are loaded through the WordPress script and style API, bundled jQuery and unused libraries removed.
* Removed: the built-in Bitbucket update checker. Updates now come from WordPress.org.

= 1.0.56 =
* Maintenance release before the 1.1.0 rewrite of the notification engine.

== Upgrade Notice ==

= 1.1.1 =
Requires WordPress 6.8 or newer. The plugin's main file is now watzap-id.php; WordPress keeps the plugin active during the update.

= 1.1.0 =
Adds the Official (WABA) channel and the new Integrations screen. After updating, open each integration once to confirm the channel and messages are as expected.
