pingwa – order and form alerts
WordPress plugin for pingwa — WhatsApp alerts for new orders (WooCommerce) and form entries (CF7, WPForms, Elementor, Gravity Forms)
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/grzgrzgrz3/pingwa-wordpress/archive/refs/heads/main.zippingwa-wp
WordPress plugin (slug pingwa): new WooCommerce orders and Contact Form 7, WPForms,
Elementor Pro and Gravity Forms submissions to WhatsApp through a pingwa hook URL. Task
distro-01 in the pingwa server repo. GPL-2.0-or-later, PHP >= 7.4, WordPress >= 6.2.
readme.txt is the WordPress.org listing.
Layout
| Path | What |
|---|---|
pingwa.php |
Plugin header, constant PINGWA_SERVER_URL, HPOS + block checkout compatibility, activation (options, not autoloaded). |
includes/class-pingwa-hook-url.php |
Hook URL rules: https://, path …/h/hk_<32 of A-Z a-z 0-9 _ -> (the server's hooks_api._TOKEN_RE), no query, credentials or fragment; masking (…/h/hk_…abcd). |
includes/class-pingwa-payload.php |
The JSON bodies. One body fits a hook without a template (text) and the server presets woocommerce_order and form_generic. Caps, skipped field types, no customer e-mail/phone/address. |
includes/class-pingwa-fields.php |
CF7 / WPForms / Elementor Pro / Gravity Forms submissions mapped to label, value, type, name. |
includes/class-pingwa-triggers.php |
Hooks, per-trigger toggles (default on while the plugin is active), order facts. |
includes/class-pingwa-sender.php |
Queue during the request, post at the last shutdown callback: one delivery per order (order meta _pingwa_notified), wp_safe_remote_post, 2 s cap, errors caught, error_log only under WP_DEBUG. |
includes/class-pingwa-settings.php |
Settings → pingwa: join link (Pingwa_Settings::JOIN_URL, filter pingwa_join_url) + QR, hook URL, toggles, Send test. manage_options, a nonce per action. |
uninstall.php |
Deletes the options (from every site of a multisite network). |
.wordpress-org/ |
WordPress.org listing art (icons, banners, screenshots), the SVN assets/ content. Not in the build zip. SUBMIT.md has the submit and SVN steps. |
bin/store-assets/ |
The generator for that art (render.py, shoot-settings.py, the pingwa mark). |
assets/join-wp-qr.svg |
QR of Pingwa_Settings::JOIN_URL (payload in its <desc>), generated by bin/make-qr.sh (segno, as the server). |
Build
bin/build.sh # build/pingwa/ and build/pingwa.zip (runtime files only)
bin/make-qr.sh # after changing JOIN_URL in includes/class-pingwa-settings.php (needs uv)
Unit tests (PHPUnit, no WordPress needed)
docker run --rm -u $(id -u):$(id -g) -e COMPOSER_HOME=/tmp/c -v $PWD:/app -w /app composer:2 composer install
docker run --rm -u $(id -u):$(id -g) -v $PWD:/app -w /app php:7.4-cli vendor/bin/phpunit
docker run --rm -u $(id -u):$(id -g) -v $PWD:/app -w /app php:8.3-cli vendor/bin/phpunit
tests/unit/bootstrap.php stubs the few WordPress functions the pure classes call.
E2E (Docker)
tests/e2e/run.sh # build, run, tear down
KEEP=1 tests/e2e/run.sh # leave it up: http://127.0.0.1:18471/wp-admin (admin/admin)
docker compose -f tests/e2e/docker-compose.yml down -v # after KEEP=1
What it does (tests/e2e/):
docker-compose.yml: MariaDB,wordpress:php8.3-apache,wordpress:cli-php8.3, andreceiver.py, an HTTPS stand-in for the pingwa server onhooks.pingwa-e2e.test(its own CA, TLS verification stays on) that writes every POST to.run/captures/. Every container, network and volume is namedpingwa-wp-*.mu-plugins/pingwa-e2e.php(E2E only, never shipped): declares the stand-in host external forwp_safe_remote_postand trusts its CA.- Installs WooCommerce (HPOS on), Contact Form 7 and Plugin Check, then
drive.py: the real admin page (nonce, capability, invalid URLs refused, masked URL, Send test with the HTTP status), a CF7 submit with hidden and file fields and a bare</>in its values, a block checkout through the Store API, an order made in code, a wp-admin order (auto-draft and pending send nothing, processing sends), a declined-then-paid retry (one message, paid status), an abandoned pending order and a 2-day-old order (nothing), status changes (no second message), the WooCommerce toggle off, a trash/untrash (nothing), a REST API batch of 100 orders (5 messages and one "…and 95 more"), an 8 s slow server (checkout and form still return in about 2 s) and the server down (nothing breaks). check_bodies.pyruns in the pingwa server repo's own environment, read-only (cd $PINGWA_SERVER_REPO && uv run --frozen --no-sync python …): every captured body throughhooks_api.render_text(a hook without a template) and thewoocommerce_order/form_genericpresets throughhooks_api.rendered_message; the join link againstjoin.join_link("wp", …); the QR against segno; and hook URLs minted byhooks_api.new_token()through the plugin's validator.- Plugin Check (
wp plugin check pingwawith runtime, experimental and low-severity checks); the run fails on any error.
Needs Docker with compose v2, python3, openssl, uv and the pingwa server repo
(PINGWA_SERVER_REPO, default ~/git/pingwa/server).
Notes
- The plugin posts with
wp_safe_remote_post, so a self-hosted pingwa server must be on a public address and port 80, 443 or 8080 (WordPress's safe-URL rule). - WordPress's cURL transport waits for the answer even when
blockingis false, so the 2 s timeout is the cap. Under PHP-FPM or LiteSpeed the response is handed to the visitor first (fastcgi_finish_request/litespeed_finish_request); under mod_php a slow server adds up to 2 s per message to that one request. - An order is sent once (
shop_orderonly: no subscriptions or refunds) when it first reaches processing, on-hold or completed: created in one of them, or moved into one from pending, failed, cancelled or a draft. The rule of WooCommerce's admin "New order" e-mail. - No floods: an order restored from the trash is never sent; an order whose
date_createdis older than 24 h (imports, migrations) is never sent; one request sends at most 5 order messages and puts the rest into one "…and N more new orders" message with the wp-admin orders link. Filters (no settings):pingwa_order_max_age(seconds, defaultDAY_IN_SECONDS) andpingwa_max_order_messages(default 5). - The join link is
https://pingwa.dev/join/wp, the server's stable redirect to WhatsApp with "join wp" on the current join number, so the plugin holds no number. Filterpingwa_join_urlreplaces it (a self-hosted server; an https:// URL, anything else is ignored). The shipped QR is the QR of the default link only: it is hidden while the link is filtered.