=== FlowMation Bridge ===
Contributors: mastechinnovations
Tags: automation, webhooks, workflow, flowmation
Requires at least: 5.8
Requires PHP: 7.4
Stable tag: 2.0.0
License: GPLv2 or later

Sends signed WordPress and optional WooCommerce order events to a FlowMation workflow webhook.

== Description ==

FlowMation Bridge posts your site's events to a FlowMation workflow webhook, signed so the workflow can verify them before anything runs:

* Post published
* Post updated
* Comment posted
* Optional WooCommerce order_created, order_payment_complete, order_status_changed and order_refunded

Each delivery is a JSON body signed with X-FlowMation-Signature, the sha256= prefixed hex HMAC-SHA256 of the raw body using a shared secret. In FlowMation, set the webhook trigger's verify mode to `wordpress` and use the same secret.

== Installation ==

1. Upload the flowmation-bridge folder to /wp-content/plugins/ or install the zip from Plugins, Add New, Upload Plugin.
2. Activate FlowMation Bridge.
3. Open Settings, FlowMation Bridge, paste the webhook URL from your FlowMation workflow trigger, and set a signing secret.
4. Pick the events to send and save.

== Frequently Asked Questions ==

= Where do I get the webhook URL? =

Create a workflow in FlowMation with a webhook trigger. The trigger shows its hook URL. Set its verify mode to `wordpress` and put the same secret in both places.

= What happens if FlowMation is unreachable? =

The delivery is best effort with a short timeout and is logged to your PHP error log on failure. Important flows should also alert on missing events.

== WooCommerce ==

WooCommerce is optional. Order and payment event switches are off by default and sites without WooCommerce continue to send post/comment events normally. Orders use exact integer amount_minor values with currency-specific precision, including zero-decimal XOF, RWF and UGX. Invalid precision or overflowing totals are not delivered. Customer email is optional; customer_phone is preserved for phone-first workflows.

Both order creation hooks share a successful-delivery marker. Payment completion is emitted once per order, status changes once per transition, and refunds once per refund ID. A database option claim prevents concurrent or reentrant sends for the same event. Failed deliveries do not create success markers and may retry on a later hook; this plugin does not promise automatic retries or distributed exactly-once delivery. A stale delivery claim is cleared after 60 seconds on a later hook.

One webhook URL receives all selected events. The WooCommerce solution pack uses this same events path for its order and payment workflows and filters by event. Use the WordPress connection webhookSecret with verifyMode wordpress. Do not also reconcile the same money from both WooCommerce payment_complete and a separate gateway callback. Refund events are informational; they do not reverse FlowMation ledger entries automatically.

== Changelog ==

= 2.0.0 =
* Add opt-in WooCommerce order, payment, status and refund events.
* Preserve exact minor units, shared HMAC signing, blog compatibility and duplicate guards.


= 1.0.0 =
* First release: signed post and comment events.
